SlideShare a Scribd company logo
Java Session 2
Contents…
Oops Concepts

Java features
Oops Concepts
•   Class
•   Object
•   Polymorphism
•   Inheritance
•   Encapsulation
•   Abstraction
OOP
Polymorphism
Polymorphism

• Polymorphism gives us the ultimate
  flexibility in extensibility. The ability to
  define more than one function with the
  same name is called Polymorphism.

• In java, c++ there are two type of
  polymorphism:
       compile time polymorphism (overloading)
       runtime polymorphism (overriding).
Polymorphism 1
Polymorphism 2
Polymorphism 3
Polymorphism 4
Polymorphism 5
Polymorphism 6
Polymorphism 7
Overloading
• Example of Overloading

       int add(int a,int b)
       float add(float a,int b)
       float add(int a ,float b)
        void add(float a)
        int add(int a)
        void add(int a) //error conflict with
                      the method int add(int a)
OverLoading
    Class BookDetails{

       String title;
       String publisher;
       float price;
          setBook(String title){ }
         setBook(String title, String publisher){}
         setBook(String title, String publisher,float


                                               price){ }
}
(overriding).
  class BookDetails{
         String title;
 setBook(String title){ }
  }


class ScienceBook extends BookDetails{
        setBook(String title){}              //overriding
        setBook(String title, String publisher,float price)
             { } //overloading
 }
Difference Between Java & C++

• In C++,
  Method Overloading is an example of Static Polymorphism
  Method Overriding is an example of Run time Polymorphism


• In Java, Method overloading and Method overriding
  can be achieved using
  static methods , final methods,private methods are
  examples of Static Polymorphism.
  Instance method is an ex of Runtime Polymorphism.
Inheritance
• Inheritance is the property which allows a
  Child class to inherit some properties from
  its parent class.

• In Java this is achieved by using extends
  keyword.

• Only properties with access modifier public
  and protected can be accessed in child
  class.
Inheritance
Inheritance 1
Inheritance 2
Inheritance 3
Inheritance 4
Inheritance
    public class Parent
       {
         public String parentName;
         public int parentage;
         public String familyName;
         }

    public class Child extends Parent
{
          public String childName;
          public int childAge;
          public void printMyName()
          {
          System.out.println(“ My name is “+ chidName+” “ +familyName);
          } }
Inheritance is the process by which object of one class
acquires the properties of another class.
Encapsulation
• Encapsulation means that all data members
  (fields) of a class are declared private.
  Some methods may be private, too.
• The class interacts with other classes
  (called the clients of this class) only
  through the class’s constructors and public
  methods.
• Constructors and public methods of a class
  serve as the interface to class’s clients.
Encapsulation
• Encapsulation is the mechanism that binds together code
  and the data if manipulates, and keeps both safe from
  outside interference and misuse.

•    One way to think about encapsulation is as a protective
    wrapper that prevents the code and data from being
    arbitrarily accessed by other code defined outside the
    wrapper.

• Access to the code and data inside the wrapper is tightly
  controlled through a well-defined interface. Conclusion:
  The wrapping up of data and methods into a single unit
  (called class) is known as encapsulation.
Abstraction
• Abstraction refers to the act of representing
  essential features without including the
  background details.

• hiding unnecessary data from the users and
  making the application as user friendly then it is
  called as abstrcation
        ex:Any mail account the user is simply
  filling the form and he don't know ho it is
  developed.
Difference Between Object-based Programming &
         Object-Oriented Programming

• Object Based Programming languages obeys all
  the features of OOPs except inheritence.
  Ex: Java Script,VB script.
• Object Oriented Programming languages obeys
  all the features of OOPs.
  Ex: C++,Java
Buzz Words
· Simple
· Secure
· Portable
· Object-oriented
· Robust
· Multithreaded
· Architecture-neutral
· Interpreted
· High performance
· Distributed
· Dynamic
Simple
•         Java is designed to be easy for the
    professional programmer to learn and use.
Secure
• secure – programs are confined to the Java
  execution environment and can not access
  other parts of the computer.
Secure




• Security problems like eavasdropping,
  Tampering and virus threats can be
  eliminated or minimized by using java on
  internet
Portable
• If a program yields the same result on every
  machine, then that program is called portable.
  Java programs are portable. This is the result of
  java’s system independent nature.
Object-oriented
• Java is pure Object oriented programming
  languages because it is satisfying oops
  features.

• Class, object, Abstraction, Inheritance,
  polymorphism, Encapsulation.
Robust
• Robust means Strong. Java programs are
  strong and they don’t crash easily like c
  and c++.
    why? Excellent Exception handling
          Memory Management
  Class loader sub system of JVM will
 allocate necessary memory for java
 program.
  Garbage Collector de allocates the
 memory
Multithreaded
• A thread represents an individual process
  to execute a group of statements. JVM uses
  several threads to execute different blocks
  of code. Creating multiple threads is called
  Multi threaded.
Compiled and Interpreted
• Java Programs are compiled to generate
  byte code.

• This byte code can be downloaded and
  interpreted by the interpreter in JVM.
High performance
• The problem with the interpreter is slow.
  To over come this problem, along with
  interpreter java soft people have
  introduced JIT (Just In Time) compiler.
• Which enhance the speed of execution.
Distributed
• Java is designed for the distributed
  environment of the Internet. Because it
  handles TCP/IP protocols

• Java supports RMI (Remote Method
  Invocation).

• This feature enables a programmer to
  invoke methods across the network.
Dynamic
• Before the development of java, only static
  texts used to be displayed in browser.

• Dynamic loading is possible using applet
  programming. Which are dynamically
  interacting programs on internet.
Thank you…




         to be contd…

More Related Content

What's hot (20)

PPTX
Abstraction java
MahinImran
 
PPTX
Constructor in java
Pavith Gunasekara
 
PPTX
Basics of JAVA programming
Elizabeth Thomas
 
PDF
Polymorphism in Java by Animesh Sarkar
Animesh Sarkar
 
PPTX
07. Virtual Functions
Haresh Jaiswal
 
PPTX
core java
Roushan Sinha
 
PPTX
Java seminar
devendrakhairwa
 
PPTX
Java(Polymorphism)
harsh kothari
 
PPT
Polymorphism in java
Lovely Professional University
 
PPS
Java Exception handling
kamal kotecha
 
PPTX
Constructor ppt
Vinod Kumar
 
PPTX
Basics of Object Oriented Programming
Abhilash Nair
 
PPT
Oops in Java
malathip12
 
PPTX
Constructor in java
SIVASHANKARIRAJAN
 
PPTX
Polymorphism in c++(ppt)
Sanjit Shaw
 
PPTX
Introduction to OOP(in java) BY Govind Singh
prabhat engineering college
 
PPSX
Arrays in Java
Hitesh-Java
 
PPT
Presentation on java
shashi shekhar
 
PPTX
Constructor in java
Hitesh Kumar
 
ODP
Basic of Java
Ajeet Kumar Verma
 
Abstraction java
MahinImran
 
Constructor in java
Pavith Gunasekara
 
Basics of JAVA programming
Elizabeth Thomas
 
Polymorphism in Java by Animesh Sarkar
Animesh Sarkar
 
07. Virtual Functions
Haresh Jaiswal
 
core java
Roushan Sinha
 
Java seminar
devendrakhairwa
 
Java(Polymorphism)
harsh kothari
 
Polymorphism in java
Lovely Professional University
 
Java Exception handling
kamal kotecha
 
Constructor ppt
Vinod Kumar
 
Basics of Object Oriented Programming
Abhilash Nair
 
Oops in Java
malathip12
 
Constructor in java
SIVASHANKARIRAJAN
 
Polymorphism in c++(ppt)
Sanjit Shaw
 
Introduction to OOP(in java) BY Govind Singh
prabhat engineering college
 
Arrays in Java
Hitesh-Java
 
Presentation on java
shashi shekhar
 
Constructor in java
Hitesh Kumar
 
Basic of Java
Ajeet Kumar Verma
 

Viewers also liked (20)

KEY
Practical OOP In Java
wiradikusuma
 
PPT
Java buzzwords
ramesh517
 
PPT
Object Oriented Programming Concepts
thinkphp
 
PPTX
oops concept in java | object oriented programming in java
CPD INDIA
 
PPT
Basic concepts of object oriented programming
Sachin Sharma
 
PPT
Object Oriented Programming with Java
backdoor
 
PPT
Oops ppt
abhayjuneja
 
PPT
OOP in Java
wiradikusuma
 
PPT
Oop java
Minal Maniar
 
PPT
Object oriented programming (oop) cs304 power point slides lecture 01
Adil Kakakhel
 
ODP
OOP java
xball977
 
PPT
Object-oriented concepts
BG Java EE Course
 
PPTX
Introduction to Object Oriented Programming
Moutaz Haddara
 
PPTX
Object+oriented+programming+in+java
Ye Win
 
PPTX
01 introduction to oop and java
রাকিন রাকিন
 
PDF
Introduction to java and oop
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Java OOP Programming language (Part 6) - Abstract Class & Interface
OUM SAOKOSAL
 
PPTX
Brain Computer Interface.ppt
Amal Sanjay
 
PDF
Java Basic Oops Concept
atozknowledge .com
 
PPT
Java interfaces
Raja Sekhar
 
Practical OOP In Java
wiradikusuma
 
Java buzzwords
ramesh517
 
Object Oriented Programming Concepts
thinkphp
 
oops concept in java | object oriented programming in java
CPD INDIA
 
Basic concepts of object oriented programming
Sachin Sharma
 
Object Oriented Programming with Java
backdoor
 
Oops ppt
abhayjuneja
 
OOP in Java
wiradikusuma
 
Oop java
Minal Maniar
 
Object oriented programming (oop) cs304 power point slides lecture 01
Adil Kakakhel
 
OOP java
xball977
 
Object-oriented concepts
BG Java EE Course
 
Introduction to Object Oriented Programming
Moutaz Haddara
 
Object+oriented+programming+in+java
Ye Win
 
01 introduction to oop and java
রাকিন রাকিন
 
Java OOP Programming language (Part 6) - Abstract Class & Interface
OUM SAOKOSAL
 
Brain Computer Interface.ppt
Amal Sanjay
 
Java Basic Oops Concept
atozknowledge .com
 
Java interfaces
Raja Sekhar
 
Ad

Similar to Java OOP s concepts and buzzwords (20)

PPTX
Java Programming - UNIT - 1, Basics OOPS, Differences
PradeepT42
 
PDF
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
PPTX
U1 JAVA.pptx
madan r
 
DOCX
Object Oriented Programming All Unit Notes
BalamuruganV28
 
DOCX
OOP Lab-manual btech in cse kerala technological university
seenamt1234
 
PDF
MCA NOTES.pdf
RAJASEKHARV10
 
PPTX
Introduction to oop and java fundamentals
AnsgarMary
 
PPTX
Java PPT
Dilip Kr. Jangir
 
PPTX
Java and its concepts
aashukaushik
 
PPTX
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
PPSX
Core java lessons
vivek shah
 
PDF
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
PDF
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
PPTX
object oriented programming unit one ppt
isiagnel2
 
DOCX
java tr.docx
harishkuna4
 
PPTX
java oops and java very important for .pptx
cherukuriyuvaraju9
 
PPTX
java oops compilation object class inheritance.pptx
CHERUKURIYUVARAJU209
 
PDF
JAVA-PPT'S.pdf
AnmolVerma363503
 
PPTX
object oriented programming concept in java.pptx
Nagasivaparvathi
 
DOCX
Java OOPs Concepts.docx
FredWauyo
 
Java Programming - UNIT - 1, Basics OOPS, Differences
PradeepT42
 
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
U1 JAVA.pptx
madan r
 
Object Oriented Programming All Unit Notes
BalamuruganV28
 
OOP Lab-manual btech in cse kerala technological university
seenamt1234
 
MCA NOTES.pdf
RAJASEKHARV10
 
Introduction to oop and java fundamentals
AnsgarMary
 
Java and its concepts
aashukaushik
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
Core java lessons
vivek shah
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
M.c.a. (sem iv)- java programming
Praveen Chowdary
 
object oriented programming unit one ppt
isiagnel2
 
java tr.docx
harishkuna4
 
java oops and java very important for .pptx
cherukuriyuvaraju9
 
java oops compilation object class inheritance.pptx
CHERUKURIYUVARAJU209
 
JAVA-PPT'S.pdf
AnmolVerma363503
 
object oriented programming concept in java.pptx
Nagasivaparvathi
 
Java OOPs Concepts.docx
FredWauyo
 
Ad

More from Raja Sekhar (7)

PPT
Exception handling
Raja Sekhar
 
PPT
Java multi threading
Raja Sekhar
 
PPT
Java packages
Raja Sekhar
 
PPT
String handling session 5
Raja Sekhar
 
PPTX
java Basic Programming Needs
Raja Sekhar
 
PPTX
Class object method constructors in java
Raja Sekhar
 
PPTX
Java Starting
Raja Sekhar
 
Exception handling
Raja Sekhar
 
Java multi threading
Raja Sekhar
 
Java packages
Raja Sekhar
 
String handling session 5
Raja Sekhar
 
java Basic Programming Needs
Raja Sekhar
 
Class object method constructors in java
Raja Sekhar
 
Java Starting
Raja Sekhar
 

Recently uploaded (20)

PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
Introduction presentation of the patentbutler tool
MIPLM
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Horarios de distribución de agua en julio
pegazohn1978
 

Java OOP s concepts and buzzwords

  • 3. Oops Concepts • Class • Object • Polymorphism • Inheritance • Encapsulation • Abstraction
  • 4. OOP
  • 6. Polymorphism • Polymorphism gives us the ultimate flexibility in extensibility. The ability to define more than one function with the same name is called Polymorphism. • In java, c++ there are two type of polymorphism: compile time polymorphism (overloading) runtime polymorphism (overriding).
  • 14. Overloading • Example of Overloading int add(int a,int b) float add(float a,int b) float add(int a ,float b) void add(float a) int add(int a) void add(int a) //error conflict with the method int add(int a)
  • 15. OverLoading Class BookDetails{ String title; String publisher; float price; setBook(String title){ } setBook(String title, String publisher){} setBook(String title, String publisher,float price){ } }
  • 16. (overriding). class BookDetails{ String title; setBook(String title){ } } class ScienceBook extends BookDetails{ setBook(String title){} //overriding setBook(String title, String publisher,float price) { } //overloading }
  • 17. Difference Between Java & C++ • In C++, Method Overloading is an example of Static Polymorphism Method Overriding is an example of Run time Polymorphism • In Java, Method overloading and Method overriding can be achieved using static methods , final methods,private methods are examples of Static Polymorphism. Instance method is an ex of Runtime Polymorphism.
  • 18. Inheritance • Inheritance is the property which allows a Child class to inherit some properties from its parent class. • In Java this is achieved by using extends keyword. • Only properties with access modifier public and protected can be accessed in child class.
  • 24. Inheritance public class Parent { public String parentName; public int parentage; public String familyName; } public class Child extends Parent { public String childName; public int childAge; public void printMyName() { System.out.println(“ My name is “+ chidName+” “ +familyName); } }
  • 25. Inheritance is the process by which object of one class acquires the properties of another class.
  • 26. Encapsulation • Encapsulation means that all data members (fields) of a class are declared private. Some methods may be private, too. • The class interacts with other classes (called the clients of this class) only through the class’s constructors and public methods. • Constructors and public methods of a class serve as the interface to class’s clients.
  • 27. Encapsulation • Encapsulation is the mechanism that binds together code and the data if manipulates, and keeps both safe from outside interference and misuse. • One way to think about encapsulation is as a protective wrapper that prevents the code and data from being arbitrarily accessed by other code defined outside the wrapper. • Access to the code and data inside the wrapper is tightly controlled through a well-defined interface. Conclusion: The wrapping up of data and methods into a single unit (called class) is known as encapsulation.
  • 28. Abstraction • Abstraction refers to the act of representing essential features without including the background details. • hiding unnecessary data from the users and making the application as user friendly then it is called as abstrcation ex:Any mail account the user is simply filling the form and he don't know ho it is developed.
  • 29. Difference Between Object-based Programming & Object-Oriented Programming • Object Based Programming languages obeys all the features of OOPs except inheritence. Ex: Java Script,VB script. • Object Oriented Programming languages obeys all the features of OOPs. Ex: C++,Java
  • 30. Buzz Words · Simple · Secure · Portable · Object-oriented · Robust · Multithreaded · Architecture-neutral · Interpreted · High performance · Distributed · Dynamic
  • 31. Simple • Java is designed to be easy for the professional programmer to learn and use.
  • 32. Secure • secure – programs are confined to the Java execution environment and can not access other parts of the computer.
  • 33. Secure • Security problems like eavasdropping, Tampering and virus threats can be eliminated or minimized by using java on internet
  • 34. Portable • If a program yields the same result on every machine, then that program is called portable. Java programs are portable. This is the result of java’s system independent nature.
  • 35. Object-oriented • Java is pure Object oriented programming languages because it is satisfying oops features. • Class, object, Abstraction, Inheritance, polymorphism, Encapsulation.
  • 36. Robust • Robust means Strong. Java programs are strong and they don’t crash easily like c and c++. why? Excellent Exception handling Memory Management  Class loader sub system of JVM will allocate necessary memory for java program.  Garbage Collector de allocates the memory
  • 37. Multithreaded • A thread represents an individual process to execute a group of statements. JVM uses several threads to execute different blocks of code. Creating multiple threads is called Multi threaded.
  • 38. Compiled and Interpreted • Java Programs are compiled to generate byte code. • This byte code can be downloaded and interpreted by the interpreter in JVM.
  • 39. High performance • The problem with the interpreter is slow. To over come this problem, along with interpreter java soft people have introduced JIT (Just In Time) compiler. • Which enhance the speed of execution.
  • 40. Distributed • Java is designed for the distributed environment of the Internet. Because it handles TCP/IP protocols • Java supports RMI (Remote Method Invocation). • This feature enables a programmer to invoke methods across the network.
  • 41. Dynamic • Before the development of java, only static texts used to be displayed in browser. • Dynamic loading is possible using applet programming. Which are dynamically interacting programs on internet.
  • 42. Thank you… to be contd…