SlideShare a Scribd company logo
1 of 23
Junayed Ahmed
Hasnat Hridoy
Ajoy Saha
M A Murad
Aong Sing
Static keyword
The static keyword is a non-access modifier used for methods
and attributes. Static methods/attributes can be accessed
without creating an object of a class
Static keyword can be used in
1.Static variable
2.static Method
3.Static Block
Why should we use Static Keyword?
1.Static keyword is used For memory management
2.It makes program more efficient by saving memory
package StaticVariable;
public class Student {
String name;
int id;
static String university="Diu";
Student(String n,int id){
this.name=n;
this.id=id;
}
void display() {
System.out.println("Name :"+name);
System.out.println("id :"+id);
System.out.println("University name:"+university);
}
public static void main(String[]args) {
Student s1=new Student("Hasnat",101);
Student s2=new Student("Junayed",102);
s1.display();
s2.display();
Static Method does not require object declaration
package staticMethod;
public class StaticMethod {
void display1() {
System.out.println("I am non static method");
}
static void dispalay2() {
System.out.println("I am static method");
}
public static void main(String[] args) {
StaticMethod ob1=new StaticMethod();
ob1.display1();
Static Method
Some restriction on Static Method
1.static method can't use non static member
2. “this” and “super” keywords can't be use in static method
3.static can't use non static but can use static
Static Block
package staticBlock;
public class block {
static int id;
static String name;
static {
id= 101;
name="Abul Hasnat HRidoy";
}
static void display() {
System.out.println("ID :"+id);
System.out.println("Name :"+
name);
}
public static void main(String[] args) {
block.display();
Encapsulation is a way to restrict the direct access to
some components of an object, so users cannot access
state values for all of the variables of a particular object.
Encapsulation can be used to hide both data members
and data functions or methods associated with an
instantiated class or object.
What is encapsulation?
Mozadded Alfeshani Murad
221-15-6047
Mozadded Alfeshani Murad
221-15-6047
Encapsulation
Real world example of encapsulation :
The bag contains different stuffs like pen, pencil,
notebook etc within it, in order to get any stuff you
need to open that bag, similarly in java an
encapsulation unit contains its data and behavior
within it and in order to access them you need an
object of that unit.
Private Value Inaccessible
class
User Class
How to make it accessible :
user class
class
Mozadded Alfeshani Murad
221-15-6047
Benefits of encapsulation programming
Encapsulation in programming has a few key
benefits.
Hiding data: Users will have no idea how classes are
being implemented or stored. All that users will know is
that values are being passed and initialized.
More flexibility: Enables you to set variables as red or
write-only. Examples include: setName(), setAge() or
to set variables as write-only then you only need to
omit the get methods like getName(), getAge() etc.
Easy to reuse: With encapsulation, it's easy to change
and adapt to new requirements
What is inheritance?
Inheritance is a mechanism in which one class acquires
all the properties and behaviors of a parent class.
In Java using “extends” keyword we inherit one class to
Another.
Why do we need Inheritance?
i.For code Reusability
ii.For method overriding
iii.To implement parent child relationship
INHERITANCE
Types of Inheritance in Java:
1.Single Level Inheritance
2.MultiLevel Inheritance
3. Hierarchical Inheritance
Single Level Inheritance:
When a class inherits another class, it is known as a single level inheritance
Multilevel Inheritance:
When there is a chain of inheritance, it is known as multilevel inheritance.
Hierarchical Inheritance:
When two or more classes inherits a single class, it is known as hierarchical inheritance.
Polymorphism
Polymorphism is the ability of an object to take on many forms. It allows
objects of different classes to be treated as same type.
● It provides flexibility to the code by taking multiple forms.
● It simplifies the code by providing a unified interface.
Polymorphism
Method overriding
Method overriding is the ability of a subclass to
provide its own implementation of a method.
Method overloading
Method overloading is when a class
provides multiple methods with the
same name but different parameters
Polymorphism can be achieved in Java in two ways
Example of Method Overriding
Example of Method Overloading
OOP_presentation.pptx
OOP_presentation.pptx

More Related Content

Similar to OOP_presentation.pptx

Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindiappsdevelopment
 
Encapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pillerEncapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pilleran7539661
 
Encapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pillerEncapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pilleran7539661
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxShahinAhmed49
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptxSajidTk2
 
Object oriented programming CLASSES-AND-OBJECTS.pptx
Object oriented programming CLASSES-AND-OBJECTS.pptxObject oriented programming CLASSES-AND-OBJECTS.pptx
Object oriented programming CLASSES-AND-OBJECTS.pptxDaveEstonilo
 
OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........FerryKemperman
 
"Study of Java Access Control Mechanism”
"Study of Java Access Control Mechanism”"Study of Java Access Control Mechanism”
"Study of Java Access Control Mechanism”IOSR Journals
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfArpitaJana28
 
Java Core Parctical
Java Core ParcticalJava Core Parctical
Java Core ParcticalGaurav Mehta
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonSujith Kumar
 

Similar to OOP_presentation.pptx (20)

Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Encapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pillerEncapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important piller
 
Encapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important pillerEncapsulation C++ Piller of OOP it is the important piller
Encapsulation C++ Piller of OOP it is the important piller
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptx
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
Java presentation
Java presentationJava presentation
Java presentation
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
Object oriented programming CLASSES-AND-OBJECTS.pptx
Object oriented programming CLASSES-AND-OBJECTS.pptxObject oriented programming CLASSES-AND-OBJECTS.pptx
Object oriented programming CLASSES-AND-OBJECTS.pptx
 
OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........
 
"Study of Java Access Control Mechanism”
"Study of Java Access Control Mechanism”"Study of Java Access Control Mechanism”
"Study of Java Access Control Mechanism”
 
oops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdfoops-123991513147-phpapp02.pdf
oops-123991513147-phpapp02.pdf
 
27c
27c27c
27c
 
27csharp
27csharp27csharp
27csharp
 
Java Core Parctical
Java Core ParcticalJava Core Parctical
Java Core Parctical
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 

Recently uploaded

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 

Recently uploaded (20)

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 

OOP_presentation.pptx

  • 1.
  • 2. Junayed Ahmed Hasnat Hridoy Ajoy Saha M A Murad Aong Sing
  • 3. Static keyword The static keyword is a non-access modifier used for methods and attributes. Static methods/attributes can be accessed without creating an object of a class Static keyword can be used in 1.Static variable 2.static Method 3.Static Block
  • 4. Why should we use Static Keyword? 1.Static keyword is used For memory management 2.It makes program more efficient by saving memory
  • 5. package StaticVariable; public class Student { String name; int id; static String university="Diu"; Student(String n,int id){ this.name=n; this.id=id; } void display() { System.out.println("Name :"+name); System.out.println("id :"+id); System.out.println("University name:"+university); } public static void main(String[]args) { Student s1=new Student("Hasnat",101); Student s2=new Student("Junayed",102); s1.display(); s2.display();
  • 6. Static Method does not require object declaration package staticMethod; public class StaticMethod { void display1() { System.out.println("I am non static method"); } static void dispalay2() { System.out.println("I am static method"); } public static void main(String[] args) { StaticMethod ob1=new StaticMethod(); ob1.display1(); Static Method
  • 7. Some restriction on Static Method 1.static method can't use non static member 2. “this” and “super” keywords can't be use in static method 3.static can't use non static but can use static
  • 8. Static Block package staticBlock; public class block { static int id; static String name; static { id= 101; name="Abul Hasnat HRidoy"; } static void display() { System.out.println("ID :"+id); System.out.println("Name :"+ name); } public static void main(String[] args) { block.display();
  • 9. Encapsulation is a way to restrict the direct access to some components of an object, so users cannot access state values for all of the variables of a particular object. Encapsulation can be used to hide both data members and data functions or methods associated with an instantiated class or object. What is encapsulation? Mozadded Alfeshani Murad 221-15-6047
  • 10. Mozadded Alfeshani Murad 221-15-6047 Encapsulation Real world example of encapsulation : The bag contains different stuffs like pen, pencil, notebook etc within it, in order to get any stuff you need to open that bag, similarly in java an encapsulation unit contains its data and behavior within it and in order to access them you need an object of that unit.
  • 11. Private Value Inaccessible class User Class How to make it accessible : user class class
  • 12. Mozadded Alfeshani Murad 221-15-6047 Benefits of encapsulation programming Encapsulation in programming has a few key benefits. Hiding data: Users will have no idea how classes are being implemented or stored. All that users will know is that values are being passed and initialized. More flexibility: Enables you to set variables as red or write-only. Examples include: setName(), setAge() or to set variables as write-only then you only need to omit the get methods like getName(), getAge() etc. Easy to reuse: With encapsulation, it's easy to change and adapt to new requirements
  • 13. What is inheritance? Inheritance is a mechanism in which one class acquires all the properties and behaviors of a parent class. In Java using “extends” keyword we inherit one class to Another. Why do we need Inheritance? i.For code Reusability ii.For method overriding iii.To implement parent child relationship INHERITANCE
  • 14. Types of Inheritance in Java: 1.Single Level Inheritance 2.MultiLevel Inheritance 3. Hierarchical Inheritance Single Level Inheritance: When a class inherits another class, it is known as a single level inheritance
  • 15.
  • 16. Multilevel Inheritance: When there is a chain of inheritance, it is known as multilevel inheritance.
  • 17. Hierarchical Inheritance: When two or more classes inherits a single class, it is known as hierarchical inheritance.
  • 18. Polymorphism Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as same type. ● It provides flexibility to the code by taking multiple forms. ● It simplifies the code by providing a unified interface.
  • 19. Polymorphism Method overriding Method overriding is the ability of a subclass to provide its own implementation of a method. Method overloading Method overloading is when a class provides multiple methods with the same name but different parameters Polymorphism can be achieved in Java in two ways
  • 20. Example of Method Overriding
  • 21. Example of Method Overloading

Editor's Notes

  1. Mozadded Alfeshani Murad
  2. Mozadded Alfeshani Murad