If you do want alphabetical order, and as long as you don't have duplicates, you can
TreeSet<String> tSet = new TreeSet<String>();
// for each person
String str = p.getName();
tSet.add(str);...
Type: Posts; User: javapenguin
If you do want alphabetical order, and as long as you don't have duplicates, you can
TreeSet<String> tSet = new TreeSet<String>();
// for each person
String str = p.getName();
tSet.add(str);...
The people's name or the Person themselves?
There is a class called ArrayList<aClass> which works like an array in that it uses arrays internally but creates new arrays when it exceeds a certain...
Let's see what this does:
public class Person {
private String forename;
private String surname;
private int age;
private String personID;
Person(johnSmith001, "John", "Smith", 43);//Error here, on "Person("
Person p = new Person(Person x, "John", "Smith", 43);
Ok, you don't have a variable called ID.