I'm writing two classes for the main program code. I'm stuck trying to do figure out how to instantiate an object of the class Address:
Address class:
public class Address
{
private String city;
private String state;
public Address()
{
city = "?";
state = "?";
}
public Address(String aCity, String aState)
{
city = aCity;
state = aState;
}
public String getCity()
{
return city;
}
public void setCity(String aCity)
{
city = aCity;
}
public String getState()
{
return state;
}
public void setState(String aState)
{
state = aState;
}
public String toString()
{
String result;
result = city + "," + state;
return result;
}
}
The class I'm writing is called "Bank.java" There's three attributes:
bankName - String
bankID - int
bankAddress - Address (this one is linked to the Address class)
initialize them:
bankName = "?";
bankID = 0;
bankAddress = <-----(How do I do it for this one?) It asks me to instantiate an object of Address, calling the constructor of the Address class to create an object of Address
Thanks,
Danny N