How do I get each addresses from each of the objects from my code. The code seems right. But it return only the House2 address, both times. It didn't return the first address.
public class House {
private static String address;
House ( String addr ) {
address = addr;
}
public static String returnAddress () {
return address;
}
public static void main (String [] args) {
House house1 = new House("house 1 address");
House house2 = new House("house 2 address");
System.out.println( house1.returnAddress());
System.out.println( house2.returnAddress());
}
}