Originally posted by Manfred Leonhardt:
The obvious advantage is that there will only be one method in memory regardless of how many objects of the class exist in memory.
Originally posted by Marilyn Monickam:
That is why I want to know what the advantage is. Does it reflect on the performance if I create an object and then invoke the method.I don't think so.
Campbell Ritchie wrote:I don't believe there is any "advantage" to making methods static.
Methods which affect or use instance fields or state must not be static; methods which do not affect or use instance information can beneficially be declared static.
Methods are loaded into the Method area when a class is loaded. They are not replicated for each instance created
Campbell Ritchie wrote:By the way: java.lang.Math isn't an abstract class. It is uninstantiable, but that is quite different from abstract.
Campbell Ritchie wrote:I hope you are not going to write a Math class; you get no end of confusion of you write classes with the same name as java.lang classes.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton