SlideShare a Scribd company logo
1 of 42
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

Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 

What's hot (20)

Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Important features of java
Important features of javaImportant features of java
Important features of java
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaion
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Core java concepts
Core java  conceptsCore java  concepts
Core java concepts
 
Flutter presentation.pptx
Flutter presentation.pptxFlutter presentation.pptx
Flutter presentation.pptx
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 

Viewers also liked

Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 

Viewers also liked (20)

Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 
Oop java
Oop javaOop java
Oop java
 
Object oriented programming (oop) cs304 power point slides lecture 01
Object oriented programming (oop)   cs304 power point slides lecture 01Object oriented programming (oop)   cs304 power point slides lecture 01
Object oriented programming (oop) cs304 power point slides lecture 01
 
OOP java
OOP javaOOP java
OOP java
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Object+oriented+programming+in+java
Object+oriented+programming+in+javaObject+oriented+programming+in+java
Object+oriented+programming+in+java
 
01 introduction to oop and java
01 introduction to oop and java01 introduction to oop and java
01 introduction to oop and java
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
Introduction to java and oop
 
Java OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & InterfaceJava OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & Interface
 
Brain Computer Interface.ppt
Brain Computer Interface.pptBrain Computer Interface.ppt
Brain Computer Interface.ppt
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Core java oop
Core java oopCore java oop
Core java oop
 

Similar to Java OOP s concepts and buzzwords

Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
Gaurav Maheshwari
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
yearninginjava
 

Similar to Java OOP s concepts and buzzwords (20)

CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
 
A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Cse java
Cse javaCse java
Cse java
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)Mcs 024 assignment solution (2020-21)
Mcs 024 assignment solution (2020-21)
 
Java programming and security
Java programming and securityJava programming and security
Java programming and security
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 
full defination of final opp.pptx
full defination of final opp.pptxfull defination of final opp.pptx
full defination of final opp.pptx
 

More from Raja Sekhar

More from Raja Sekhar (7)

Exception handling
Exception handlingException handling
Exception handling
 
Java multi threading
Java multi threadingJava multi threading
Java multi threading
 
Java packages
Java packagesJava packages
Java packages
 
String handling session 5
String handling session 5String handling session 5
String handling session 5
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
Class object method constructors in java
Class object method constructors in javaClass object method constructors in java
Class object method constructors in java
 
Java Starting
Java StartingJava Starting
Java Starting
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

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…