1static or class method
21) A method that is declared as static is known as the static method
32) We don't need to create the objects to call the static methods
43) Non-static (instance) members cannot be accessed in static context
5(static method, static block and static nested class) directly.
64) For example: public static int cube(int n){
7return n*n*n*; (multiply *) }
8
9Instance method
101) A method that is not declared as static is known as the instance method.
112) The object is required to call the instance method.
123) Static and non-static variables both can be accessed in instance methods.
134) For example: public void msg() {
14...}.
15
1static or class method
21) A method that is declared as static is known as the static method
32) We don't need to create the objects to call the static methods
43) Non-static (instance) members cannot be accessed in static context
5(static method, static block and static nested class) directly.
64) For example: public static int cube(int n){
7return n*n*n*; (multiply *) }
8
9Instance method
101) A method that is not declared as static is known as the instance method.
112) The object is required to call the instance method.
1STATIC METHODS: belongs to the class.
2Static methods I can call it through the class.
3Very easy to use it.
4You do not need to object to call it.
5In my framework, getmethod in my driver class is static.
6From the Configuration Reader Class,
7you can call Getpropertymethod throught
8the class name directly is static.
9All methods we are creating custom methods are static.
10We can use only static in custom methods nothing else.
11Static method we cannot use instance variables.
12NON-STATIC METHODS: means it belongs to the object.
13you can not call it through class name
14If you have instance method, you can use any variables inside
15that instance methods.
16Only the Instance method can be overridden in Java.