+ 13

What is difference between static (class) method and instance method?

21st Feb 2017, 11:38 PM
No Name
5 Answers
+ 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(){...}.
22nd Feb 2017, 10:30 AM
No Name
+ 4
Answer: Class methods are passed the calling class, static methods aren't
16th Apr 2019, 4:42 PM
Darius Bartlett
Darius Bartlett - avatar
+ 2
Static class methods cannot be overridden or at least not meant to be overridden, and they don't have to be instanciated.
22nd Feb 2017, 4:29 AM
Garrett Barlocker
Garrett Barlocker - avatar
+ 1
Class methods are passed the calling class, static methods aren't
28th Jan 2020, 6:49 AM
GOVINDHARAJPERUMAL R
GOVINDHARAJPERUMAL R - avatar
0
what is book and float use for
24th May 2017, 6:28 PM
crazy rats
crazy rats - avatar