I took the time to correct all the errors. The rewritten program
worked on my JVM. The main method is just a test method for the class
itself. Hope this helps.
public class Passenger
{
String name;
String address;
int age;
Passenger (String n, String add, int a)
{
name = n;
address = add;
age = a;
}
public int getAge ()
{
return age;
}
public String getAddress ()
{
return address;
}
public String getName ()
{
return name;
}
public void print ()
{
System.out.println ("My name is " + name);
System.out.println ("My address is " + address);
System.out.println ("My age is " + age);
}
public static void main (String [] args)
{
Passenger [] travellerlist = new Passenger [3];
travellerlist [0] = (new Passenger ("Jim", "12 Birdie Street,
London", 48));
travellerlist [1] = (new Passenger ("Sue", "24 Baker Street,
Manchester", 22));
travellerlist [2] = (new Passenger ("Matt", "2 Shop Ave,
Bristol", 31));
for (int i = 0 ; i < 3 ; i++)
{
travellerlist [i].Print ();
System.out.println
("==========================");
}
}
}