java oop s concepts and buzzwords
DESCRIPTION
Presented by: N.V.RajaSekhar Reddy www.technolamp.co.in Want more interesting... Watch and Like us @ https://www.facebook.com/Technolamp.co.in subscribe videos @ http://www.youtube.com/user/nvrajasekharTRANSCRIPT
![Page 1: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/1.jpg)
Java Session 2
![Page 2: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/2.jpg)
Contents…
Oops Concepts
Java features
![Page 3: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/3.jpg)
Oops Concepts
• Class
• Object
• Polymorphism
• Inheritance
• Encapsulation
• Abstraction
![Page 4: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/4.jpg)
OOP
![Page 5: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/5.jpg)
Polymorphism
![Page 6: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/6.jpg)
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).
![Page 7: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/7.jpg)
Polymorphism 1
![Page 8: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/8.jpg)
Polymorphism 2
![Page 9: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/9.jpg)
Polymorphism 3
![Page 10: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/10.jpg)
Polymorphism 4
![Page 11: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/11.jpg)
Polymorphism 5
![Page 12: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/12.jpg)
Polymorphism 6
![Page 13: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/13.jpg)
Polymorphism 7
![Page 14: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/14.jpg)
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)
![Page 15: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/15.jpg)
OverLoading Class BookDetails{
String title; String publisher; float price;
setBook(String title){ } setBook(String title, String publisher)
{} setBook(String title, String publisher,float
price){ } }
![Page 16: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/16.jpg)
(overriding).
class BookDetails{ String title;
setBook(String title){ }
}
class ScienceBook extends BookDetails{
setBook(String title){} //overriding
setBook(String title, String publisher,float price)
{ } //overloading
}
![Page 17: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/17.jpg)
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.
![Page 18: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/18.jpg)
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.
![Page 19: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/19.jpg)
Inheritance
![Page 20: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/20.jpg)
Inheritance 1
![Page 21: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/21.jpg)
Inheritance 2
![Page 22: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/22.jpg)
Inheritance 3
![Page 23: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/23.jpg)
Inheritance 4
![Page 24: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/24.jpg)
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);} }
![Page 25: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/25.jpg)
Inheritance is the process by which object of one class acquires the properties of another class.
![Page 26: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/26.jpg)
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.
![Page 27: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/27.jpg)
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.
![Page 28: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/28.jpg)
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.
![Page 29: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/29.jpg)
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
![Page 30: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/30.jpg)
Buzz Words
· Simple· Secure · Portable· Object-oriented· Robust· Multithreaded· Architecture-neutral· Interpreted· High performance· Distributed · Dynamic
![Page 31: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/31.jpg)
Simple
• Java is designed to be easy for the professional programmer to learn and use.
![Page 32: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/32.jpg)
Secure
• secure – programs are confined to the Java execution environment and can not access other parts of the computer.
![Page 33: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/33.jpg)
Secure
• Security problems like eavasdropping, Tampering and virus threats can be eliminated or minimized by using java on internet
![Page 34: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/34.jpg)
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.
![Page 35: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/35.jpg)
Object-oriented
• Java is pure Object oriented programming languages because it is satisfying oops features.
• Class, object, Abstraction, Inheritance, polymorphism, Encapsulation.
![Page 36: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/36.jpg)
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
![Page 37: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/37.jpg)
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.
![Page 38: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/38.jpg)
Compiled and Interpreted
• Java Programs are compiled to generate byte code.
• This byte code can be downloaded and interpreted by the interpreter in JVM.
![Page 39: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/39.jpg)
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.
![Page 40: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/40.jpg)
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.
![Page 41: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/41.jpg)
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.
![Page 42: Java OOP s concepts and buzzwords](https://reader033.vdocuments.mx/reader033/viewer/2022061618/555c3da8d8b42a2c068b4b73/html5/thumbnails/42.jpg)
Thank you…
to be contd…