±Û¾´ÀÌ :ÀÓäÀÏ 1998³â 1¿ù 20ÀÏ 12:23:54
In Reply to: À±°æ±¸´Ô ÀÌ source Á» ºÁÁÖ¼¼¿ä... posted by ¹Ú¼Ò¾Æ on 1998³â 1¿ù 20ÀÏ 11:44:49:
import java.io.*;
class ifElse {
public static void main (String args[]) {
char firstInitial;
System.out.println("Enter your first initial:");
try{
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!");
}catch(IOException e){
System.out.println("Error in reading from console");
System.exit(-1);
}
}
}