SlideShare a Scribd company logo
Object	Oriented	Programming
1.
2.
3.
4.
5.
6.
7.

It follows bottom up approach in program design.
New functions and data items can be added easily.
Data is given more importance than functions.
It emphasizes on safety and security of data.
Data is hidden and cannot be accessed by external functions.
Objects communicate each other by sending messages in the form of functions.
It helps in wrapping up of data and methods together in a single unit which is known as class and this process is called
data encapsulation.
8. Some Examples of OOP Languages- C++, Java, C#, PHP.

Advantages of OOP
1.
2.
3.
4.
5.
6.
7.
8.
9.

Principle of data hiding helps programmer to design and develop safe programs
Software complexity decreases.
Code reusability in terms of inheritance.
Object oriented systems can be easily upgraded from one platform to another.
Improved software Maintainability.
It implements real life scenario.
Faster development: Reuse enables faster development.
Lower cost of development: The reuse of software also lowers the cost of development.
Higher-quality software: Faster development of software and lower cost of development allows more time and
resources to be used in the verification of the software.
10. In OOP, programmer not only defines data type but also deals with operations applied for data structures.

Disadvantages of OOP
1. Larger program size: Object-oriented programs typically involve more lines of code than procedural programs.
2. Steep learning curve: The thought process involved in object-oriented programming may not be natural for some
people, and it can take time to get used to it.
3. Slower programs: Object-oriented programs are typically slower than procedure-based programs, as they typically
require more instructions to be executed.
4. Not suitable for all types of problems: There are problems that lend themselves well to functional-programming
style, logic-programming style, or procedure-based programming style, and applying object-oriented programming in
those situations will not result in efficient programs.

Class
1.
2.
3.
4.

A class serves as a blueprint or a plan or a template or a prototype.
A class is a collection of data members and methods.

It specifies what data and what functions will be included in objects of that type.
Defining a class does not create any object.
5. Once a class has been defined, we can create any number of objects belonging to that class.
6. A class is thus a collection of objects of similar type.
7. All the attributes of a class are fixed before, during and after the execution of a program.

Object		

1. An object is an instance of a class.
2. Objects have states and behaviors.
Example: A dog has states - color, name, breed as well as behaviors -wagging, barking and eating.
3. Object’s state is stored in fields and behavior is shown via methods.
4. Objects are identified by its unique name.
5. Every object belongs to a class.
6. Object has a limited lifespan.
7. During the lifetime, the attributes of the object may undergo significant change.
8. Objects are created and eventually destroyed.

Data	Members	

We have two types of data members 1. Instance/non-static data members
Syntax- <object name>.<data member>
Ex. text, editable, enabled, toolTipText in JTextField class
2. Static data members
Syntax- <class name>.<data member>

Methods
Ex. Math.PI

Each and every method is meant for performing some operation.
We have two types of methods they are-

1. Instance/ non –static methods
Syntax- <object name>.<method name>
Ex. jTextField1.setText(), jTextField1.getText(), jLabel1.setToolTipText

2. Static methods
Syntax- <class name>.<method name>
Ex.

JOptionPane.showMessageDialog(null,”this is message dialog”);
Math.pow(3,2);
Polymorphism

Polymorphism allows the programmer to give a generic name to various methods or operators to minimize his memorizing of
multiple names.
1. The ability to appear in many forms.
2. In object oriented programming there is a provision by which an operator or a method exhibits different
characteristics depending upon different sets of input provided to it.
3. Two examples of polymorphism are
a. Method Overloading
i. Method overloading is where a method name can be associated with different set of
arguments/parameters and method bodies in the same class.
Ex. round() method of Math class and
Substring method of String class
float f=12.5;
double d=123.6543;
int num1=Math.round(f); //num1 will store 13
float num2=Math.round(d); //num2 will store 124.0
b. Operator Overloading
i. In this Overloading, different operators have different implementations depending on their arguments.
ii. Java doesn't support user-defined operator overloading.
iii.
‘+’ operator for String and int is an example of operator overloading
String a=”hello”, b =”world”;
String c=a+b;
int num1=10, num2=20;
int num3=num1+num2;

//c will store helloworld
//num3 will store 30

Inheritance	

Inheritance enables the programmer to effectively utilize already established characteristics of a class in new
classes and applications.

1.
2.
3.
4.
5.
6.
7.
8.
9.

The extended class is termed the direct superclass, base class, or parent class.
The extending class is termed the direct subclass, derived class, or child class.
Create a new class as an extension of another class, primarily for the purpose of code reuse.
The derived class inherits the public methods and public data of the base class.
A subclass can extend only one superclass
Inheritance defines an is-a relationship between a superclass and its subclasses.

The process of inheritance does not affect the base class.
extends keyword is used in java to inherit data members and methods of a base class.
Final classes can be inherited.
Ex. String (java.lang.String)
Math (java.lang.Math)

Syntax of Inheritance
class Subclass-name extends Superclass-name
{
//methods and fields
}

Advantages of Inheritance
1.
2.
3.
4.
5.

Inheritance allows reusability of code.
A debugged class can be adapted to work in different situations.
Saves Time and Effort.
Increases Program Structure which results in greater reliability.
It is very useful in original conceptualization and design of a programming problem.

1.
2.
3.
4.
5.
6.
7.
8.
9.

The classes for which it is not essential to declare objects to use them are known as abstract class.
abstract classes are used for defining generic methods where there is no requirement of storing results.
An abstract class is a class that is designed to be specifically used as a base class.
abstract classes are classes that contain one or more abstract methods.
An abstract method is a method that is declared, but contains no implementation.
abstract keyword is used to denote both an abstract method, and an abstract class.
A class must be declared abstract if any of the methods in that class are abstract.
abstract class is one that does not provide implementations for all its methods.
An Abstract class can contain non abstract methods too.
Ex.
Number class (java.lang.Number)
Component (javax.awt.Component)
JComponent (javax.swing.JComponent)

Abstract	Class

Concrete	class

1. A concrete class in java is one which implements the functionalities of an abstract class.
Examples of concrete classesi.
JLable class (javax.swing.JLable) because it extends abstract class JComponent (javax.swing.JComponent)
ii.
JButton class(javax.swing.JButton) because it extends abstract class AbstractButton
(javax.swing.AbstractButton)

More Related Content

What's hot

Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
Satyam Jaiswal
 
Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
biswajit2015
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
Sakthi Durai
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Haris Bin Zahid
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
MOHIT TOMAR
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)Jay Patel
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
Sujit Majety
 
Concepts of oops
Concepts of oopsConcepts of oops
Concepts of oops
Sourabrata Mukherjee
 
Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]Asfand Hassan
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basicsvamshimahi
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Iqra khalil
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented concepts
Maryo Manjaruni
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
Elizabeth alexander
 
Vb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.netVb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.net
bantamlak dejene
 
Question Classification using Semantic, Syntactic and Lexical features
Question Classification using Semantic, Syntactic and Lexical featuresQuestion Classification using Semantic, Syntactic and Lexical features
Question Classification using Semantic, Syntactic and Lexical features
IJwest
 

What's hot (20)

Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
Concepts of oops
Concepts of oopsConcepts of oops
Concepts of oops
 
Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]Course outline [csc241 object oriented programming]
Course outline [csc241 object oriented programming]
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented concepts
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Vb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.netVb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.net
 
Question Classification using Semantic, Syntactic and Lexical features
Question Classification using Semantic, Syntactic and Lexical featuresQuestion Classification using Semantic, Syntactic and Lexical features
Question Classification using Semantic, Syntactic and Lexical features
 

Viewers also liked

Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
Harish Gyanani
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handlingpinkpreet_kaur
 
Learn How to create pyramids in c
Learn How to create pyramids in cLearn How to create pyramids in c
Learn How to create pyramids in c
Harish Gyanani
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder if
Harish Gyanani
 
Sql like operator examples
Sql like operator examplesSql like operator examples
Sql like operator examples
Harish Gyanani
 
Inline functions in c++
Inline functions in c++Inline functions in c++
Inline functions in c++
Harish Gyanani
 
12th information practices mysql practice questions
12th information practices mysql practice questions12th information practices mysql practice questions
12th information practices mysql practice questions
Harish Gyanani
 
100 images for visual brainstorming
100 images for visual brainstorming100 images for visual brainstorming
100 images for visual brainstorming
Marc Heleven
 

Viewers also liked (8)

Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handling
 
Learn How to create pyramids in c
Learn How to create pyramids in cLearn How to create pyramids in c
Learn How to create pyramids in c
 
Difference between switch and ladder if
Difference between switch and ladder ifDifference between switch and ladder if
Difference between switch and ladder if
 
Sql like operator examples
Sql like operator examplesSql like operator examples
Sql like operator examples
 
Inline functions in c++
Inline functions in c++Inline functions in c++
Inline functions in c++
 
12th information practices mysql practice questions
12th information practices mysql practice questions12th information practices mysql practice questions
12th information practices mysql practice questions
 
100 images for visual brainstorming
100 images for visual brainstorming100 images for visual brainstorming
100 images for visual brainstorming
 

Similar to 12th ip CBSE chapter 4 oop in java notes complete

Oops concepts
Oops conceptsOops concepts
Oops concepts
ACCESS Health Digital
 
UNIT1-JAVA.pptx
UNIT1-JAVA.pptxUNIT1-JAVA.pptx
UNIT1-JAVA.pptx
ssuser99ca78
 
Oops
OopsOops
OOPJ.pptx
OOPJ.pptxOOPJ.pptx
OOPJ.pptx
ssuser99ca78
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
AnmolVerma363503
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
cesarmendez78
 
chapter - 1.ppt
chapter - 1.pptchapter - 1.ppt
chapter - 1.ppt
SakthiVinoth78
 
Application package
Application packageApplication package
Application packageJAYAARC
 
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxINDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
Indu65
 
Oop in kotlin
Oop in kotlinOop in kotlin
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
RAJASEKHARV10
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
Shipra Swati
 
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
AnkurSingh340457
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
RubaNagarajan
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
Saravanakumar viswanathan
 
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
Synapseindiappsdevelopment
 

Similar to 12th ip CBSE chapter 4 oop in java notes complete (20)

Oops concepts
Oops conceptsOops concepts
Oops concepts
 
UNIT1-JAVA.pptx
UNIT1-JAVA.pptxUNIT1-JAVA.pptx
UNIT1-JAVA.pptx
 
Oops
OopsOops
Oops
 
Oop
OopOop
Oop
 
OOPJ.pptx
OOPJ.pptxOOPJ.pptx
OOPJ.pptx
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
chapter - 1.ppt
chapter - 1.pptchapter - 1.ppt
chapter - 1.ppt
 
Application package
Application packageApplication package
Application package
 
Unit-V.pptx
Unit-V.pptxUnit-V.pptx
Unit-V.pptx
 
Oops
OopsOops
Oops
 
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxINDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptx
 
Oop in kotlin
Oop in kotlinOop in kotlin
Oop in kotlin
 
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
 
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
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 

12th ip CBSE chapter 4 oop in java notes complete

  • 1. Object Oriented Programming 1. 2. 3. 4. 5. 6. 7. It follows bottom up approach in program design. New functions and data items can be added easily. Data is given more importance than functions. It emphasizes on safety and security of data. Data is hidden and cannot be accessed by external functions. Objects communicate each other by sending messages in the form of functions. It helps in wrapping up of data and methods together in a single unit which is known as class and this process is called data encapsulation. 8. Some Examples of OOP Languages- C++, Java, C#, PHP. Advantages of OOP 1. 2. 3. 4. 5. 6. 7. 8. 9. Principle of data hiding helps programmer to design and develop safe programs Software complexity decreases. Code reusability in terms of inheritance. Object oriented systems can be easily upgraded from one platform to another. Improved software Maintainability. It implements real life scenario. Faster development: Reuse enables faster development. Lower cost of development: The reuse of software also lowers the cost of development. Higher-quality software: Faster development of software and lower cost of development allows more time and resources to be used in the verification of the software. 10. In OOP, programmer not only defines data type but also deals with operations applied for data structures. Disadvantages of OOP 1. Larger program size: Object-oriented programs typically involve more lines of code than procedural programs. 2. Steep learning curve: The thought process involved in object-oriented programming may not be natural for some people, and it can take time to get used to it. 3. Slower programs: Object-oriented programs are typically slower than procedure-based programs, as they typically require more instructions to be executed. 4. Not suitable for all types of problems: There are problems that lend themselves well to functional-programming style, logic-programming style, or procedure-based programming style, and applying object-oriented programming in those situations will not result in efficient programs. Class 1. 2. 3. 4. A class serves as a blueprint or a plan or a template or a prototype. A class is a collection of data members and methods. It specifies what data and what functions will be included in objects of that type. Defining a class does not create any object.
  • 2. 5. Once a class has been defined, we can create any number of objects belonging to that class. 6. A class is thus a collection of objects of similar type. 7. All the attributes of a class are fixed before, during and after the execution of a program. Object 1. An object is an instance of a class. 2. Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors -wagging, barking and eating. 3. Object’s state is stored in fields and behavior is shown via methods. 4. Objects are identified by its unique name. 5. Every object belongs to a class. 6. Object has a limited lifespan. 7. During the lifetime, the attributes of the object may undergo significant change. 8. Objects are created and eventually destroyed. Data Members We have two types of data members 1. Instance/non-static data members Syntax- <object name>.<data member> Ex. text, editable, enabled, toolTipText in JTextField class 2. Static data members Syntax- <class name>.<data member> Methods Ex. Math.PI Each and every method is meant for performing some operation. We have two types of methods they are- 1. Instance/ non –static methods Syntax- <object name>.<method name> Ex. jTextField1.setText(), jTextField1.getText(), jLabel1.setToolTipText 2. Static methods Syntax- <class name>.<method name> Ex. JOptionPane.showMessageDialog(null,”this is message dialog”); Math.pow(3,2);
  • 3. Polymorphism Polymorphism allows the programmer to give a generic name to various methods or operators to minimize his memorizing of multiple names. 1. The ability to appear in many forms. 2. In object oriented programming there is a provision by which an operator or a method exhibits different characteristics depending upon different sets of input provided to it. 3. Two examples of polymorphism are a. Method Overloading i. Method overloading is where a method name can be associated with different set of arguments/parameters and method bodies in the same class. Ex. round() method of Math class and Substring method of String class float f=12.5; double d=123.6543; int num1=Math.round(f); //num1 will store 13 float num2=Math.round(d); //num2 will store 124.0 b. Operator Overloading i. In this Overloading, different operators have different implementations depending on their arguments. ii. Java doesn't support user-defined operator overloading. iii. ‘+’ operator for String and int is an example of operator overloading String a=”hello”, b =”world”; String c=a+b; int num1=10, num2=20; int num3=num1+num2; //c will store helloworld //num3 will store 30 Inheritance Inheritance enables the programmer to effectively utilize already established characteristics of a class in new classes and applications. 1. 2. 3. 4. 5. 6. 7. 8. 9. The extended class is termed the direct superclass, base class, or parent class. The extending class is termed the direct subclass, derived class, or child class. Create a new class as an extension of another class, primarily for the purpose of code reuse. The derived class inherits the public methods and public data of the base class. A subclass can extend only one superclass Inheritance defines an is-a relationship between a superclass and its subclasses. The process of inheritance does not affect the base class. extends keyword is used in java to inherit data members and methods of a base class. Final classes can be inherited. Ex. String (java.lang.String)
  • 4. Math (java.lang.Math) Syntax of Inheritance class Subclass-name extends Superclass-name { //methods and fields } Advantages of Inheritance 1. 2. 3. 4. 5. Inheritance allows reusability of code. A debugged class can be adapted to work in different situations. Saves Time and Effort. Increases Program Structure which results in greater reliability. It is very useful in original conceptualization and design of a programming problem. 1. 2. 3. 4. 5. 6. 7. 8. 9. The classes for which it is not essential to declare objects to use them are known as abstract class. abstract classes are used for defining generic methods where there is no requirement of storing results. An abstract class is a class that is designed to be specifically used as a base class. abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. abstract keyword is used to denote both an abstract method, and an abstract class. A class must be declared abstract if any of the methods in that class are abstract. abstract class is one that does not provide implementations for all its methods. An Abstract class can contain non abstract methods too. Ex. Number class (java.lang.Number) Component (javax.awt.Component) JComponent (javax.swing.JComponent) Abstract Class Concrete class 1. A concrete class in java is one which implements the functionalities of an abstract class. Examples of concrete classesi. JLable class (javax.swing.JLable) because it extends abstract class JComponent (javax.swing.JComponent) ii. JButton class(javax.swing.JButton) because it extends abstract class AbstractButton (javax.swing.AbstractButton)