Wednesday 29 February 2012

OOPS Basics

1.What are the basic four principle concepts of OOPS?
The Basic four OOPS Concepts are

  • Abstraction :Abstarction means showing only the essential features of a class and hiding the all background details.It is Design Time Concept
  • Polymorphism : Single Name Multiple Forms
There are three ways by which Polymorphism can be achived in Java
1)Method Overloading
2)Method Overriding of Classes
3)Method Overriding of Interfaces

There are two types of Polymorphism
1)RunTime Polymorphism:As which methods to call is decided at runtime it is also know as late binding or Dynamic binding e.g Method Overriding
2)Compile Time Polymorphism :As call to methods are resolved at compile time it is known as Early Binding or Static binding.e.g. Method Overloading
  • Inheritance :It is a IS-A relationship.Inheritance enables code reuse.Child Class Inherites traits of its Parent class.Thus child class can reuse functionality of its Parent class and can aslo add extr features
  • Encapsulation :Encapsulation enables data hiding.Object encapsulates Attributes and Properties.Access to these Attributes and Properties are restricted from outside world and provided only the appropriate access
2.What is Aggreagtion and Composition
  • Aggregation.: Class contains object of another class as its member.Its a HAS-A relationship
  • Composition : Its special type of Aggragation.Differnce from Aggragation is that the member object must exist for existance of Main Class object

No comments:

Post a Comment