oops basic questions Part -1


What is an Object?
An Object is a real world entity. An Object has a state and behavior.
A Software object is an instance of a class.
And the sate of an object is represented with variables and the behavior of an object is represented with methods.
Why Java is not fully objective oriented?
Due to the use of primitives in java, which are not objects?
What is a class?
A Class is model; A Class is a blue print.
A Class includes the properties that are similar to all the objects.
A Class represents similar type of objects.
A Class is type or user defined data type we can instantiate n number of objects for this type.
A Class encapsulates the sate and behavior of the object to gather as single unit.
A Class hides the data from the rest of outside by declaring variables as private
And it provides access through the public methods.
What is Encapsulations.?
Binding the data and the methods that manipulates the data together as a single unit is called Encapsulation.
Encapsulation hides its data from the rest of the world by declaring the variables as private. And provide access through the public methods.
What is abstraction?
Hiding unwanted and unnecessary data from the user view and expose only the data that is useful or interested to the user. World map is best example for an abstraction it does not show all the data of the world it hides the unnecessary data and shows a use full data.
So data abstraction is simplified view of an object that includes only features one is interested in while hides away the unnecessary details.
In programming languages user defined data types are examples for abstractions.
The advantage of abstraction is that every user will get his own view of the data according to his requirements and will not get confused with unnecessary data.
What is the difference between abstraction and encapsulation?
Through Encapsulation we can achieve abstraction. Hence abstraction is a perspective and encapsulation is implementation to achieve that perspective.
www.000webhost.com