-
Java - BufferedReader개발노하우/Java 2007. 4. 18. 12:54
import java.io.*;
class Mem_sub {
private BufferedReader in;
private String name;
private int age;
public Mem_sub(){
in=new BufferedReader (new InputStreamReader(System.in));
name="";
age=0;
}
public void setname() throws IOException{
System.out.print("이름=");
name=in.readLine();
}
public void setage()throws IOException{
System.out.print("나이=");
age=Integer.parseInt(in.readLine());
}
public void disp(){
System.out.println(name+"님!");
System.out.println("당신은"+age+"세 이시군요!");
}
}
public class Mem01{public static void main(String[] ar)throws IOException{
Mem_sub mem=new Mem_sub();
mem.setname();
mem.setage();
System.out.println("===================");
mem.disp();
}
}