Method Overloading, Static & Instance
Method overloading
Jvm Compiler
class hirun { compile programme;
void hirun (){
hirun - 3 method
} hirun ();
void hirun (int x){ hirun (int x) {}
} argument int
hirun (8);
void hirun (int y, String z){ hirun (int y, String z) {}
} argument int, String
hirun (7, "abc");
}
- The parts highlighted with the same colour with the code and the Jvm compiler are connected each other.
- When we are creating methods again and again in a same class we can use method overloading concept.
- We can over load methods using Parameters. Its called as the "Parameter Signature".
Parameter Signature = (changing parameters and identifying)
- Creating methods using Parameter Signature in the same class with the same name is called method overloading.
Static & Instance (non-static)
String a = "hirun";
void hirun(){
}
- Orange coloured method is an Instance method (non-static)
Static int b = 5; static void b = hirun() { }
- Red coloured method is a Static method.
- Static is a keyword, methods and variables made by the static keyword is known as static variables and methods. Variables and methods without the keyword static are called, non- static (instance) variables and methods.
- We can access Static things without an object inside the class.
void hirun (){ } int hirun (){ } void hirun (int y, int z){ }
- If the return type differs, Method name and parameters are equal. Method Overloading won't occur. (It is compulsory to change the parameter sign as a law.)
- Red coloured method is a Static method.
- Static is a keyword, methods and variables made by the static keyword is known as static variables and methods. Variables and methods without the keyword static are called, non- static (instance) variables and methods.
- We can access Static things without an object inside the class.
void hirun (){
}
int hirun (){
}
void hirun (int y, int z){
}
- If the return type differs, Method name and parameters are equal. Method Overloading won't occur. (It is compulsory to change the parameter sign as a law.)


Comments
Post a Comment