I just started Java and one of my programs isnt working right. Help Please!

1 view
Skip to first unread message

Jacob

unread,
Jun 2, 2008, 7:41:34 AM6/2/08
to Java User Group For City Of Mysore In Karnataka, India
Here is a copy of the program

class Help {

public static void main(String args[])
{
throws java.io.IOException
{ //Gives an error here
on compiling
char choice;

System.out.println("Help on:");
System.out.println(" 1. if");
System.out.println(" 2. switch");
System.out.println("Enter your choice:");

choice=(char) System.in.read();

switch (choice)
{
case '1' :
System.out.println("The If:");
System.out.println("if(condition)statment");
System.out.println("else statment");
break;
case '2' :
System.out.println("The Switch");
System.out.println("switch(expression) {");
System.out.println(" case constant:");
System.out.println(" statment sequence");
System.out.println(" break");
System.out.println("..........//");
System.out.println("}");
break;
default:
System.out.println("Invalid Choice");

}

}
}


}
Reply all
Reply to author
Forward
0 new messages