Class(Logical construct):
Template or Blueprint of an object.
or
Structure and Behaviour of an object.
Object(Physical reality):
Instance of a class .
Overloading:
Same method name and method signature to be vary.
Method signature -> number of arguements
-> order of arguements
-> diff data types
Overriding:
Method name and signature to be same.
abstract class:
It is a class that cannot instantiate. It can be extended or subclassed. It may or may not contain abstarct method. abstract method is a method to have only method definition not implementation(its ends with semi-colen without curly brackets). It is used to single inheritance.
interface:
It is a refernce type similar to a class. It contains common methods and constants to a group of classes.
All interface to be pure abstract. It is used to multiple inheritance.
final:
In front of variable - to be constant.
In front of method - cannot override.
In front of class - cannot inherit.
public -> can acess within class / same package / other package.
private->can acess within class.
protected-> can acces within class / same package / parent-child relationship.
default-> can acces within class / same package .
No comments:
Post a Comment