SlideShare a Scribd company logo
1 of 23
Hello!
We are Team
Quadra
Our Group members are:
Nafiz Ar Rafi (ID: 17182103359)
Shohana Iasmin (ID: 17182103322)
MD. Maruf Hossain (ID:
Sinthia Sayeed (ID:
Rokonuzzaman Razu (ID: 17182103211)
1
Presentation On Object
Oriented programming
(OOP)
Java OOP basic feature
1
Features of OOP
Abstraction: In Java, abstraction means simple things
like objects, classes and variables represent more
complex underlying code and data. This is important
because it lets you avoid repeating the same work
multiple times.
Encapsulation: The practice of keeping fields within a
class private, then providing access to those fields via
public methods. Encapsulation is a protective barrier
that keeps the data and code safe within the class
itself.
Polymorphism: Allows programmers to use the same
word in Java to mean different things in different
contexts. One form of polymorphism is method
overloading. The other form is method overriding.
Inheritance: Inheritance is a special feature of Object-
Oriented Programming in Java that lets programmers
create new classes that share some of the attributes of
existing classes.
4
“
5
The simple abstraction example that is given above has a
class Car. In this class Car, we have an abstract method to
accelerate (). Then we inherit this class in the Suzuki class.
Inside the Suzuki class, we implement the accelerated
method.
Example of Abstraction
Example of Encapsulation
6
Encapsulation is demonstrated as an OOP concept in Java. Here, the
variable “name” is kept private or “encapsulated.”
7
Example of Polymorphism
In this example, we are creating two classes Bike and Splendor. Splendor class
extends Bike class and overrides its run() method. We are calling the run method by
the reference variable of Parent class. Since it refers to the subclass object and
subclass method overrides the Parent class method, the subclass method is invoked at
runtime
Example of Inheritance
8
In the above example, Programmer object can access the field of own class as
well as of Employee class.
Access Modifier
2
What are the Access
modifiers?
We can change the access level of fields,
constructors, methods, and classes in Java
programs by applying the access modifier to
them. The access level refers to the
accessibility or scope of a field, method,
constructor, or class.
10
Access
Modifi
er
There are four types of java access
modifiers
11
Private modifier: The access level of a private modifier is only within the class. It cannot be accessed from outside
the class.
Default modifier: The access level of a default modifier is only within the package. It cannot be accessed from
outside the package. If you do not specify any access level, it will be the default.
Protected modifier: The access level of a protected modifier is within the package and outside the package through
child class. If you do not make the child class, it cannot be accessed from outside the package.
Public modifier: The access level of a public modifier is everywhere. It can be accessed from within the class,
outside the class, within the package and outside the package.
Constructor And Destructor
3
What is Java
constructor and
destructor?
13
A constructor is used to initialize a variable that means it allocates memory for the same A
constructor is nothing but automatic initialization of the object. Whenever the program
creates an object at that time constructor, is gets called automatically. You don’t need to
call this method explicitly.
On the other hand, Destructor is used to free that memory allocated during initialization.
Generally, in java, we don’t need to call the destructor explicitly. Java has a feature of
automatic garbage collection.
Why Constructor and
destructor is needed?
14
Constructor and destructor are mostly used to
handle memory allocation and de-allocation
efficiently.
Constructor and destructor do a very important role
in any programming language of initializing and
destroying it after use to free up the memory space.
Interface in Java
4
What do Interface mean in
java programming?
16
An interface is a programming structure/syntax that allows the
computer to enforce certain properties on an object (class).
For example: say we have a car class and a scooter class and a truck class. Each of
these three classes should have a start_engine() action. How the "engine is started" for
each vehicle is left to each particular class, but the fact that they must have a
start_engine action is the domain of the interface.
Static Variable
5
What is Static Variable
if we declare any variable as static, it is known as a static variable.
18
The static variable can be used to refer to the common property of all
objects.
For example, the company name of employees, University name of
students, etc. It makes your program memory efficient
Let’s see how static
variable in java is created
19
6
Let's explain:
We created a class called Student with three variables –
studentName, course, and University.
The first instance – Student1 – which has access to the
variables created in its class had these values:
Student1.studentName = “AB";
Student1.course = "Data Visualization";
Student1.University = “BUBT";
Second instance –Student2 - had these values:
Student2.studentName = "CD";
Student2.course = "Data Analysis with Java";
As we declare University as a static variable that’s why we didn’t
have to create its object in the second instance.
Diagram
21
Student
-studentName: String
-course: String
-University: String
Student1
+studentName: String
+course: String
+University: String
Student2
+studentName: String
+course: String
Class: Student
First Instance Class: Student1 Second Instance Class: Student2
22
Explain:
Student Class has this types of values –
-studentName: String
-course: String
-University: String
The first instance – Student1 – has these values-
+studentName: String
+course: String
+University: String
Second instance – Student2- has these values-
+studentName: String
+course: String
Thanks!
That’s all from our
side
23

More Related Content

Similar to OOP in Java Presentation.pptx

Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Ayes Chinmay
 
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDevLabs Alliance
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptxSajidTk2
 
Top 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETTop 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETDevLabs Alliance
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetdevlabsalliance
 
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
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfnofakeNews
 
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
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questionsGradeup
 
Object-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdfObject-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdfBharath Choudhary
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questionssatish reddy
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questionssatish reddy
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxkristinatemen
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdfvenud11
 

Similar to OOP in Java Presentation.pptx (20)

Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
 
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdet
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
Top 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETTop 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDET
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
 
OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
 
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
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Object-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdfObject-Oriented Programming in Java.pdf
Object-Oriented Programming in Java.pdf
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questions
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questions
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptx
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdf
 

Recently uploaded

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

OOP in Java Presentation.pptx

  • 1. Hello! We are Team Quadra Our Group members are: Nafiz Ar Rafi (ID: 17182103359) Shohana Iasmin (ID: 17182103322) MD. Maruf Hossain (ID: Sinthia Sayeed (ID: Rokonuzzaman Razu (ID: 17182103211) 1
  • 3. Java OOP basic feature 1
  • 4. Features of OOP Abstraction: In Java, abstraction means simple things like objects, classes and variables represent more complex underlying code and data. This is important because it lets you avoid repeating the same work multiple times. Encapsulation: The practice of keeping fields within a class private, then providing access to those fields via public methods. Encapsulation is a protective barrier that keeps the data and code safe within the class itself. Polymorphism: Allows programmers to use the same word in Java to mean different things in different contexts. One form of polymorphism is method overloading. The other form is method overriding. Inheritance: Inheritance is a special feature of Object- Oriented Programming in Java that lets programmers create new classes that share some of the attributes of existing classes. 4
  • 5. “ 5 The simple abstraction example that is given above has a class Car. In this class Car, we have an abstract method to accelerate (). Then we inherit this class in the Suzuki class. Inside the Suzuki class, we implement the accelerated method. Example of Abstraction
  • 6. Example of Encapsulation 6 Encapsulation is demonstrated as an OOP concept in Java. Here, the variable “name” is kept private or “encapsulated.”
  • 7. 7 Example of Polymorphism In this example, we are creating two classes Bike and Splendor. Splendor class extends Bike class and overrides its run() method. We are calling the run method by the reference variable of Parent class. Since it refers to the subclass object and subclass method overrides the Parent class method, the subclass method is invoked at runtime
  • 8. Example of Inheritance 8 In the above example, Programmer object can access the field of own class as well as of Employee class.
  • 10. What are the Access modifiers? We can change the access level of fields, constructors, methods, and classes in Java programs by applying the access modifier to them. The access level refers to the accessibility or scope of a field, method, constructor, or class. 10 Access Modifi er
  • 11. There are four types of java access modifiers 11 Private modifier: The access level of a private modifier is only within the class. It cannot be accessed from outside the class. Default modifier: The access level of a default modifier is only within the package. It cannot be accessed from outside the package. If you do not specify any access level, it will be the default. Protected modifier: The access level of a protected modifier is within the package and outside the package through child class. If you do not make the child class, it cannot be accessed from outside the package. Public modifier: The access level of a public modifier is everywhere. It can be accessed from within the class, outside the class, within the package and outside the package.
  • 13. What is Java constructor and destructor? 13 A constructor is used to initialize a variable that means it allocates memory for the same A constructor is nothing but automatic initialization of the object. Whenever the program creates an object at that time constructor, is gets called automatically. You don’t need to call this method explicitly. On the other hand, Destructor is used to free that memory allocated during initialization. Generally, in java, we don’t need to call the destructor explicitly. Java has a feature of automatic garbage collection.
  • 14. Why Constructor and destructor is needed? 14 Constructor and destructor are mostly used to handle memory allocation and de-allocation efficiently. Constructor and destructor do a very important role in any programming language of initializing and destroying it after use to free up the memory space.
  • 16. What do Interface mean in java programming? 16 An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class). For example: say we have a car class and a scooter class and a truck class. Each of these three classes should have a start_engine() action. How the "engine is started" for each vehicle is left to each particular class, but the fact that they must have a start_engine action is the domain of the interface.
  • 18. What is Static Variable if we declare any variable as static, it is known as a static variable. 18 The static variable can be used to refer to the common property of all objects. For example, the company name of employees, University name of students, etc. It makes your program memory efficient
  • 19. Let’s see how static variable in java is created 19
  • 20. 6 Let's explain: We created a class called Student with three variables – studentName, course, and University. The first instance – Student1 – which has access to the variables created in its class had these values: Student1.studentName = “AB"; Student1.course = "Data Visualization"; Student1.University = “BUBT"; Second instance –Student2 - had these values: Student2.studentName = "CD"; Student2.course = "Data Analysis with Java"; As we declare University as a static variable that’s why we didn’t have to create its object in the second instance.
  • 21. Diagram 21 Student -studentName: String -course: String -University: String Student1 +studentName: String +course: String +University: String Student2 +studentName: String +course: String Class: Student First Instance Class: Student1 Second Instance Class: Student2
  • 22. 22 Explain: Student Class has this types of values – -studentName: String -course: String -University: String The first instance – Student1 – has these values- +studentName: String +course: String +University: String Second instance – Student2- has these values- +studentName: String +course: String