[3848] in java-interest
Need help doing If with a String and a Int
daemon@ATHENA.MIT.EDU (Jonathan_Mark_Smith@CCMAIL.PRUSEC.)
Wed Nov 29 21:26:08 1995
From: Jonathan_Mark_Smith@CCMAIL.PRUSEC.COM
Date: Wed, 29 Nov 95 18:10:54 EST
To: java-interest@java.sun.com
Can some please help me I am trying to check the first args coming in
to a int to see if the user wents to run in mode 1 or 2. I can not
get this code to com. Y?
How can I test if a String value is the same as a integer value?
class NewJava {
public static void main(String args[]){
System.out.print("Mode (1 or 2): ");
System.out.print(args[0]);
System.out.print("\n");
for(int i = 1; i < 3; i++){
if((int)args[0] == 1){
PrintOut(args[i]);
} else {
System.out.print(args[i]);
}
}
System.out.print("\n");
}
public static void PrintOut(String input){
System.out.println(input);
}
}
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com