夜
夜游神宾
Unregistered / Unconfirmed
GUEST, unregistred user!
public class a
{
public static void main(String[] args)
{
char a;
System.out.println("Please Into a Number 1-3");
a = (char)System.in.read();
switch(a)
{
case '1':
System.out.println("your into Number is 1");
break;
case '2':
System.out.println("your into Number is 2");
break;
case '3':
System.out.println("your into Number is 2");
break;
default:
System.out.println("your into Number is "+a);
break;
}
}
}
javac a.java
错误提示如下:
a.java:8: unreported exception java.io.IOException;
must be caught or declared to be thrown
a = (char)System.in.read();
^
1 error
这是为什么,我没看出错误???
请各位大侠多多指教我(刚刚开始学java两天)。
{
public static void main(String[] args)
{
char a;
System.out.println("Please Into a Number 1-3");
a = (char)System.in.read();
switch(a)
{
case '1':
System.out.println("your into Number is 1");
break;
case '2':
System.out.println("your into Number is 2");
break;
case '3':
System.out.println("your into Number is 2");
break;
default:
System.out.println("your into Number is "+a);
break;
}
}
}
javac a.java
错误提示如下:
a.java:8: unreported exception java.io.IOException;
must be caught or declared to be thrown
a = (char)System.in.read();
^
1 error
这是为什么,我没看出错误???
请各位大侠多多指教我(刚刚开始学java两天)。