class address
{
String address;
String newaddr = address.trim();
final int ziplength =4;
String input;
Scanner in = new Scanner(System.in);
String temp
class address
{
String address;
String newaddr = address.trim();
final int ziplength =4;
String input;
Scanner in = new Scanner(System.in);
String temp = in.next();
String zipcode = input.substring(input.length()-ziplength);
public address() //this is the only thing I add, but it eliminate "illegal start type error"
{
try
{
Integer.parseInt(zipcode);
System.out.println("PO is: "+zipcode);
}
catch( Exception e)
{
System.err.println("Last 4 chars are not a number.");
}
}
}
Special thank you for @Jägermeister . He gives me valuable hint.
Since I am a beginner, I am thinking a better way to improve my skills. I will try more.