I am a java beginner and started learning java last week.
I am trying to make a program whereby when i key in the roll number 'for example; person 1' and the program output the name, age, race and sex.
I did it the long way but it is not what I want,
public static void main(String[] args) {
Person person1 = new Person();
person1.name = "Miyuki";
person1.race = "Asian";
person1.sex = "Female";
person1.age = 35;
System.out.println(person1.name + " " + person1.race + " " + person1.sex + " " + person1.age);
That is not what I am aiming for.
I want the whole thing to come out as one when I key in person 1.
"name : Miyuki";
"race : Asian";
"sex : Female";
"age : 35;
NB: I plan also to add person 2. person 3 and so on.
should I use grid? strring arrays or what?
Have no idea.
Help me