It's three completely different things:
public
means that the method is visible and can be called from other objects of other types. Other alternatives are private
, protected
, package
and package-private
. See here for more details.
static
means that the method is associated with the class, not a specific instance (object) of that class. This means that you can call a static method without creating an object of the class.
void
means that the method has no return value. If the method returned an int
you would write int
instead of void
.
The combination of all three of these is most commonly seen on the main
method which most tutorials will include.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…