Can we call methods of non-static classes without an object in Java?
Posted
by
ask
on Stack Overflow
See other posts from Stack Overflow
or by ask
Published on 2012-10-13T21:21:14Z
Indexed on
2012/10/13
21:37 UTC
Read the original article
Hit count: 147
In Java, the wrapper class Integer has the static method parseInt() which is used like this: Integer.parseInt(). I thought only methods of static classes could be called like this (ie. Class.doMethod()). All non-static classes need objects to be instantiated to use their methods. I checked the API, and apparently Integer is declared as public final Integer - not static. Someone please help me understand this.
© Stack Overflow or respective owner