I want to know if you can create use a static method of a class that has a constructor, but you haven't created an instance of that class. This may be a stupid question, but oh well: I'm a stupid person then.
Yes... you can call a static method of a class before any objects of it exist. That is why the preferred way of calling a static method is with the class name instead of the instance name...
... and many, many more.
Also, all classes have a constructor... if you do not supply one, Java gives you the default constructor with no parameters.
P.S. - No question is a stupid question, as long as you learn from it... ( though why didn't you just try testing this out yourself... ) [This message has been edited by Nathan Pruett (edited June 19, 2001).]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Jun 17, 2001
I was just confusing myself. I understood all along. I don't even know why I asked the question. What does a class having a constructor have anything to do with being able to call one of that class' static methods! I'm a dolt.
Conrad, Conrad, Conrad . . . (Cindy shakes head), You KNOW what I'm going to say here. There ARE no stupid questions. Just think how many people who were secretly thinking the same thing that you have now help understand it better. Why - You are practically a HERO !
"JavaRanch, where the deer and the Certified play" - David O'Meara