I am trying to create a toString method which return the name, address and phone number of a person. The output format that I want as following:
Anna Brown
1234 Sweet Road
Los Angeles, CA 99999
Phone: 888.8888.888
The address is 1234 Sweet Road Los Angeles, CA 99999 but I want the city is in a new line. I tried this but it does not work. can someone help me out please?
public String toString()
{
return String.format( "%-25s\n %-14s\n\n\n%-25s",
name,address, phone );
}