Category Archives: Java

Java

Java classes

public void addFriend(Person friend);

Public signifies that the class is going to be public and called.

Void means that it will not return a value but do something.

addFriend is the name.

Person and friend are the items passed when it’s void.

If the class is going to return something declare the variable type it will return:
public String getFriends();

Instance variables:

private [type] [name]