[Q] java.io.IoException must be caught ....?


[ Follow Ups ] [ Post Followup ] [ 자바 묻고 답하기 ]

Posted by 양정윤 on April 12, 1997 at 03:09:41:

책에는 있는 예제를 컴파일 하는데 좀처럼 되질 않구 왜그런지는
모르겠구 답답해서 이렇게 글을 씁니다/....Please, Help me!!

Source file:
class IfElseName {
public static void main (String args[]) {
char firstInitial;
System.out.println("Enter your first initial:");
firstInitial = (char) System.in.read();
if (firstInitial == -1)
System.out.println("Now what kind of name is that!?");
else if (firstInitial == 'j')
System.out.println("Your name must be Jules!");
else if (firstInitial == 'v')
System.out.println("Your name must be Vincent!");
else if (firstInitial == 'z')
System.out.println("Your name must be Zed!");
else
System.out.println("I can't figure out your name!");
}
}

Error Message :
Exception java.io.IoException must be caught, or
it must be declared in the throws clause of this method.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ 자바 묻고 답하기 ]