Public Void vs Private int?

Post date: Jan 13, 2015 4:54:30 PM

What does it mean when we see these terms at the start of a Java method?

example: public void setName (String newName)

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.

void means that the method has no return value. If the method returned an int you would write int instead of void