Java OOP s concepts and buzzwords


Published on

Presented by: N.V.RajaSekhar Reddy

Want more interesting...
Watch and Like us @
subscribe videos @

Published in: Education
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Java OOP s concepts and buzzwords

  1. 1. Java Session 2
  2. 2. Contents…Oops ConceptsJava features
  3. 3. Oops Concepts• Class• Object• Polymorphism• Inheritance• Encapsulation• Abstraction
  4. 4. OOP
  5. 5. Polymorphism
  6. 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).
  7. 7. Polymorphism 1
  8. 8. Polymorphism 2
  9. 9. Polymorphism 3
  10. 10. Polymorphism 4
  11. 11. Polymorphism 5
  12. 12. Polymorphism 6
  13. 13. Polymorphism 7
  14. 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. 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. 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. 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. 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.
  19. 19. Inheritance
  20. 20. Inheritance 1
  21. 21. Inheritance 2
  22. 22. Inheritance 3
  23. 23. Inheritance 4
  24. 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. 25. Inheritance is the process by which object of one classacquires the properties of another class.
  26. 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. 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. 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 dont know ho it is developed.
  29. 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. 30. Buzz Words· Simple· Secure· Portable· Object-oriented· Robust· Multithreaded· Architecture-neutral· Interpreted· High performance· Distributed· Dynamic
  31. 31. Simple• Java is designed to be easy for the professional programmer to learn and use.
  32. 32. Secure• secure – programs are confined to the Java execution environment and can not access other parts of the computer.
  33. 33. Secure• Security problems like eavasdropping, Tampering and virus threats can be eliminated or minimized by using java on internet
  34. 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. 35. Object-oriented• Java is pure Object oriented programming languages because it is satisfying oops features.• Class, object, Abstraction, Inheritance, polymorphism, Encapsulation.
  36. 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. 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. 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. 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. 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. 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. 42. Thank you… to be contd…