Javatpoint Logo

how to explain java oops concept with the realtime exampls

By: savith*** On: Tue Apr 03 09:21:18 IST 2018     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
how to explain java oops concept with the realtime examplsUp0Down

 
Image Created0Down

By: [email protected] On: Tue Apr 03 11:19:57 IST 2018 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
polymorphism :best example is human .we perform different activities at different places in home we are a doughter or son
at school we are a student
outside we are a citizen .
Abstraction: when we have an idea about an start up we just tell the idea but not about the implementation details
similarly in java abstraction we are just telling functionality nut not the code.
inheritance: in company there is s project with 1000 lines of code
and the first 500 are generated by an employee and he left the office after that the work is given to other employee
so the other employee extends the properties done by previous employee to reduce his time in working over 1000 lines again.
Image Created0Down

By: [email protected] On: Thu May 03 14:53:27 IST 2018 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
OOPS Concept With Real Life Example

Objects: Object is the basic unit of object-oriented programming.Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.

An Object is a collection of data members and associated member functions also known as methods.

Classes: Classes are data types based on which objects are created.Objects with similar properties and methods are grouped together to form a Class. Thus a Class represent a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects becomes functions of the class and is referred to as Methods.

Example #1:

For example consider we have a Class of Cars under which Santro Xing, Alto and WagonR represents individual objects. In this context each Car Object will have its own, Model,Year of Manufacture, Colour, Top Speed, Engine Power etc.,which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car class. No memory is allocated when a class is created. Memory is
allocated only when an object is created, i.e., when an instance of a class is created.
Image Created0Down

By: [email protected] On: Fri Dec 07 12:39:19 IST 2018 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No