class Person {
private String lastName;
private String firstName;
private int age;
public Person(String last, String first, int a) {
lastName = last;
firstName = first;
age = a;
}
public String toString() {
return "Last name: " + lastName + " First name: " + firstName + " Age: " + age;
}
public String getLast() {
return lastName;
}
}
public class MainClass {
public static void main(String[] args) {
Person[] persons = new Person[10];
for(int i=0;i<persons.length;i++){
persons[i] = new Person("A","B",10);
}
for(Person p: persons){
System.out.println(p.getLast());
}
}
}
A
A
A
A
A
A
A
A
A
A