Difference about Scanner vs DataInputStream

[출처] http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040201&docId=139373099

Question:

숫자를 입력받을때

DataInputStream in = new DataInputStream(System.in);

int userNumber = Integer.parseInt(in.readLine());

이렇게 해서 입력받는거랑

Scanner sc = new Scanner(System.in)

int userNumber = sc.nextInt();

이거랑 무슨 차이가 있는거죠?

 

Answer:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s