Abc
Abc
static is keyword
All static member will get stored inside static pool or class area.
syntax:
className.VariableName;
className.methodName();
Example:
static age=20;
s.o.p()
p.s.v.m(String[] agrs){
Student.age();
s.o.p(+age);
Student.regno();
method Overloading:
process of multiple method with same name but different in parameter is known as method
overloading.
Rules:
Ex:
void buy(){
s.o.pln();
s.o.pln();
s.o.pln();
main(){
c.buy();
c.buy("20");
c.buy(25,5.0,"murali");
access in same class access in different class stored loc no’s of copy
static directly or class name class name static pool, class area 1
non static object creation object creation heap area multiple object
depends on no’s of objects
Array:
Array declaration:
Int[] a;
Array creation:
a=new Int[5];
Array initialization:
A[2]=20;
Int[] a={20,30,40,50};
Inheritance:
Inheritance process of one class acquiring another class properties is known as inheritance.
3.sharing properties of a class is known as parent class, super class, base class
4.Aquiring properties of a class is known as sub class, child class, derived class.
Types:
1.single level
2.multi-level
3.hierachical
4.hybrid
5.multiple inheritance
1.single inheritance:
3.hieracical inheritance;
4.hybrid inheritance:
5.multiple inheritance:
Is combination of one sub class and multiple super class is known as
Ex;
Class Car{
Mainclass:
Class Student1{
Main(){
s.o.pln();
s.o.pln();
2.Constructor Overloading.
Process of having multiple constructor with same name but different in parameter is known as
constructor overloading.
Rules:
Class car{
Int cost;
String brand;
Double interest;
This.brand=brand;
This.interest=interest;
Car(double cost){
s.o.pln();
Car(int cost){
s.o.pln();
Main(){
Method Overriding:
Is process of a inheriting method have same name and same datatype is know as method Overriding
but different in implementation is known as
Example:
Class car{
Void buy(){
s.o.pln(“old bike”);
@Overriding
Void buy(){
s.o.pln(“modified bike”);
Main(){
} }
Super:
1.super is a Keyword.
2.which is use to access super class member or different class we can access using super keyword.
Syntax:
Super.variableName;
Super.methodName();
Constructor chaining;
The process of one constructor to calling another constructor is know as Constructor chaining.
Is-A relationship(Inheritance).
If super class is non parameterized constructor the sub class constructor call implicitly.
EX:
Advantage: