0
What is static methods ? How to call them
3 Réponses
+ 2
In contrast to non-static methods (which involves initializing and using an object), static methods are invoked through the class name.
Most of the methods in the Math class, for example, are static methods.
You would call the abs(int a) function like this:
int num = -100;
System.out.println(Math.abs(num));
===================
What you would NOT do:
int num = -100;
Math obj = new Math();
System.out.println(obj.abs(num));
0
I need more simple definition and clear example
0
Java Software Solutions 9th Edition PDF --> chapter 7.3.
Read this and do the self-review questions at the end of the chapter.
Answers are in Appendix L.