Greetings.
If I am not mistaken, the target in the switch statement works for Integers only.
Java experts, please correct me if I'm wrong.
You could use If statements instead if switch doesn't work.
import java.util.StringTokenizer;
class Birthday
{
public static void main(String[] arguments)
{
StringTokenizer st1;
String birthday = "09/08/1900";
st1 = new StringTokenizer(birthday, "/");
String month = st1.nextToken();
if(month=="01")
month = "January";
else if(month=="02")
month = "February";
else if(month=="03")
month = "March";
else if(month== "04")
month = "April";
else if(month== "05")
month = "May";
else if(month== "06")
month = "June";
else if(month== "07")
month = "July";
else if(month== "08")
month = "August";
else if(month== "09")
month = "September";
else if(month== "10")
month = "October";
else if(month== "11")
month = "November";
else if(month== "12")
month = "December";
String day = st1.nextToken();
String year = st1.nextToken();
System.out.println("The month is " + month);
System.out.println("The day is " + day);
System.out.println("The year is " + year);
}
}
I think that should work. ;)