How to create a list/structure? in JAVA
- by lox
i have to create a list of ,let's say 50 people, (in JAVA) and display the list, and i don't really know how to do that. so this is what i have tried to do so far . please correct and complete some of my code .
public class Person {
String name;
String stuff;
}
public class CreatePerson {
public static void ang() {
ArrayList<Person> thing=new ArrayList<Person>();
Scanner diskScanner = new Scanner(in);
for(int i=0; i<50; i++){
Person pers = new Person();
out.print("name: ");
pers.name=diskScanner.nextLine();
out.print("stuff: ");
pers.stuff=diskScanner.nextLine();
thing.add(pers);
break;
}
// Display people
for (int i=0; i<50; i++) {
out.println(??);{
}
} }}