• We Code
  • We Design
  • We Develope
  • We Write
  • We Share

menu

Monday, September 3, 2012

oops Concept In JAVA

The oop is mainly based on 4 concept

  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism 
Encapsulation :  Encapsulation encapsulates both data and function . Its nothing but the binding of variables and methods


Abstraction : Abstraction does not only mean declaring methods/functions and class as abstract.

its main aim is to hide the implementation details of method and exposes only functionality.


Inheritance :The two main aim of OOPS is to achieve code re-usability and runtime binding of code.



code re-usability  we can achieve one with inheritance and the other one is through instantiation (creating object of  the class).Inheritance mean writing a class with required variables and functions that are common to more than sub class and deriving/extending that class into many sub classes is called as inheritance.

All the variables and functions of the super class become the variables and functions of sub class except private members(variables/functions).
The best example for inheritance is deriving label,TextField and Button classes from component super class.
Polymorphism : We can classify polymorphism into 2 types:

  •       Overloading
  •       Overriding
   Overloading :overloading in java means writing same function for many times with different function signatures (number of parameters and types of parameters) but not the return type of the function.Functions may belong to supper class or sub classes.
    Overriding :Overriding in java means rewriting super class function in sub class with the same signature and return type is called as function overriding.    
Compile time binding means  static binding and Runtime binding  means Dynamic binding

2 comments:

  1. nice going java learning course author . looking forward for exapmles of oops in jva course . thx

    ReplyDelete
  2. mui bean !! mi gusta tu java learning blog

    ReplyDelete

...