+ 13
What is difference between static (class) method and instance method?
5 Réponses
+ 12
Found this answers
Static or class method
1)A method i.e. declared as static is known as static method.
2)Object is not required to call static method.
3)Non-static (instance) members cannot be accessed in static context (static method, static block and static nested class) directly.
4)For example: public static int cube(int n){ return n*n*n;}
Instance method
1)A method i.e. not declared as static is known as instance method.
2)Object is required to call instance methods.
3)static and non-static variables both can be accessed in instance methods.
4)For example: public void msg(){...}.
+ 4
Answer: Class methods are passed the calling class, static methods aren't
+ 2
Static class methods cannot be overridden or at least not meant to be overridden, and they don't have to be instanciated.
+ 1
Class methods are passed the calling class, static methods aren't
0
what is book and float use for