-2

You must construct at least one instance of a class to use the class's static methods.

True or False? I can't seem to come up with an answer. I don't know the first thing to do to tackle this question.

Buddy
  • 47
  • 1
  • 2
    I am confused by the reasons for the votes to close. It is definitely not too broad or requiring too long an answer - the existing answer, including the appropriate JLS quote, is three lines long. It seems perfectly clear to me what is being asked, and my interpretation matches the answer, so I don't think it is unclear what is being asked. It is a very basic question, but as far as I know there is no rule against that. – Patricia Shanahan Dec 04 '15 at 00:20
  • 2
    You can [do some research](http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html) and/or [try it yourself](http://ideone.com/JQokNt). – TNT Dec 04 '15 at 00:24
  • 1
    @PatriciaShanahan Maybe it is unclear why OP is unable (or unwilling) to read a few things about "static methods"? Like [this](https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html) or [this](http://stackoverflow.com/questions/2671496/java-when-to-use-static-methods) or [this](http://www.programmingsimplified.com/java/source-code/java-static-method-program) or [this](http://crunchify.com/java-static-methods-variables-static-block-and-class-with-example/). – Tom Dec 04 '15 at 00:29
  • @PatriciaShanahan, completely agree. The SO community seems not to like basic questions. Voting to reopen. – jb. Dec 04 '15 at 00:29
  • @Tom, so leave a comment "here are a few resources that might help [helpful links]" as TNT did. How is the question "unclear"? – jb. Dec 04 '15 at 00:37
  • 3
    @jb. I didn't vote to close, but fwiw: I think it's not so much that the community dislikes basic questions. The community dislike questions where the answers are easily found online, and where the question doesn't clarify what about existing answers confuses the OP. What's unclear here isn't the question per se, it's what the OP doesn't understand about the many answers to this question that are already out there. Without that info, all we can do is to play guess and check: "is this the thing you don't understand? Or is it this other thing?" – yshavit Dec 04 '15 at 01:31

1 Answers1

1

You must construct at least one instance of a class to use the class's static methods.

False. static methods (aka class methods) are at the class level, not the instance level. The JLS link says (in part) A class method is always invoked without reference to a particular object.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249