So I've made a 'friends' class in Java, each friend having a: Name, Birthday, Nickname, Type. I don't know how to print out all of this data per each friend in the class, and that is my goal. I want to be able to have something like this:
for(//each person in my friends class, print out the data)
and the have it look something like this:
System.out.println("Name: " + Friend.name);
System.out.println("Bday: " + Friend.birthday);
System.out.println("Nickname: " + Friend.nickname);
System.out.println("Type: " + Friend.type);
and the output would be something like:
Name: Spencer
Bday: 101002
Nickname: Colin
Type: Tier 1
Here's what I have so far:
import java.util.Random;
class friends {
String name;
int birthday;
String nickname;
String type;
}
public class RipStefan {
public static void main(String[] args) {
friends Colin = new friends();
Colin.name = "Spencer";
Colin.birthday = 101002;
Colin.nickname = "Colin";
Colin.type = "Tier 1";
friends Sanger = new friends();
Sanger.name = "Oliver";
Sanger.birthday = 112702;
Sanger.nickname = "Sanger";
Sanger.type = "Tier 1";
friends Paul = new friends();
Paul.name = "Paul";
Paul.birthday = 022103;
Paul.nickname = "PBJ";
Paul.type = "Tier 1";
}
}
Sorry if any of the formatting is off, this is my first question on Stack Overflow.