OOPS (Object Oriented Programming System) is a programming approach which provides solution to problems with the help of algorithms based on real world. It uses real world approach to solve a problem.
Main Oops concepts are :
Class : A class is declared using class keyword. A class is a blue print or set of instruction to bind the data with its related and corresponding functions.
Object :
An object is an entity which contain state and behaviour. Object is nothing but instance of a class.
An object has three characteristics:
Main Oops concepts are :
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
Class : A class is declared using class keyword. A class is a blue print or set of instruction to bind the data with its related and corresponding functions.
A Class can contain :-
- Fields
- methods,
- constructors
- objects
class <class_name>{
field;
method;
}
|
Object :
An object is an entity which contain state and behaviour. Object is nothing but instance of a class.
An object has three characteristics:
- State : represent state of an object.
- Behaviour: represent behaviour of an object. The functionalities associated with the object => Behavior of the object.
- Identity: represent identity of an object.
- Using New keyword
- Class.forName()
- Using Clone()
- Using Deserilization
For more details click here
How a class is initialized in java?
A Class is initialized in Java when an instance of class is created using either new operator or using reflection using class.forName(). A class is also said to be initialized when a static method of Class is invoked or a static field of Class is assigned.
A Class is initialized in Java when an instance of class is created using either new operator or using reflection using class.forName(). A class is also said to be initialized when a static method of Class is invoked or a static field of Class is assigned.
No comments:
Post a Comment