object-oriented programming is a software design approach in which concept of
"object" occupies the first place.
Object is something which has state,behaviour,identity and responsibility.
State : is giving values to attributes.
behaviour:means response given to outside World.
identity : means uniqueness associated with every object
resposibility : role of an object.
Abstraction : means Selective ignorance.(hiding the implimantaion and showing the
Functionality.)
At the end of abstraction we get state of and object.
Encapsulation : is a process of binding and hiding of state and behaviour because
in real life they are inseparable and hidden by default.
Inheritance: is a way of "re-using" already define classes with "is-a"
Relationship. inheritance is achieved by using the extends keyword only public and
protected fields can be accessed in child class.
Interface : is a special block of java which only contain set of abstract method to
provide complete data abstraction.
polymorphism :
when same message given to generalised things for same Behaviour but implemented
differently is called polymorphism
A class with multiple methods by the same name but different parameters called
method overloading
in method overriding a child class has the same method name, same method signature
and same return types as a method in its parent class, then the child class method
haas overriden the parent class method.
Constructor : it is used to initialize the data of the object.
Automatically when we create constructor.
[Link] == Class Name
[Link] does not return any [Link] even Void
public Student() // Non-Parameterized Constructor
{
}
public Student(int a,int b,String str) // Parameterized Constructor
When java Create automatically - default Constructor
if class does not have any constructor then java Creates one default Constructor
this Keyword :
-> Refer current invoking object.
-> this()->for calling current class constructor from inside different constructor
of same class.
Super Keyword:
-> Super Keyword refer to immediate parent
super()-> use to call parent class Constructor from inside child class constructor
Threads allows a program to operate more efficiently by doing multiple things at
the same time.
Threads can be used to perform complicated tasks in the background without
interrupting the main program.