본문 바로가기

Web Dev/JAVA

자바연수) 4월16일

http://d.hatena.ne.jp/jflute/20130522/errorsinging :쿠보상블로그

http://hyeonstorage.tistory.com/249 :BufferReader / BufferWriter 

과 관련된 이야기


BuR이라 치고 단축키 사용하기 그럼 더 빨리 찾는게 가능해진다.

폴더 없는 쪽 Ctrl+alt+r을 누르면 파일을 찾을 수 있다. 

Command + 해당 이름 클릭 : 그 메소드의  소스코드를 볼 수 있음



package javatry.privates.enjoy.new2015.windows.lesson.chapter03;

import java.io.*;


public class HowOldAreYou {


    public static void main(String[] args) {

        System.out.println("あなたの名前を入力してください。");

        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

        //

        

        try{

         String line =reader.readLine();//콘솔부터 대신 불러들여온다. 실제로 입력한 녀석을 line에 넣어줍니다.


         

         System.out.println(line+"さん、こんにちは。");

         System.out.println("年齢を入力してください");

         line=reader.readLine(); //한번 한번 씩 불러들여준

         int age =Integer.parseInt(line);

         System.out.println("今"+age+"歳とすると、10年後は"+(age+10)+"歳ですね");

         

         System.out.println("자 그럼 한국어로 합시다.okay?(yes/no)");

         line=reader.readLine();

         

         if(line=="yes"){

             

         }else if(line=="no"){

             

         }else{

             System.out.println("いたずら禁止");

             

         }

         

        }catch(IOException e){//마네 안마리 안하는게 좋다. 실제로 쓸때 힘듦.

            System.out.println(e);

        }catch(NumberFormatException e){ //Exception :例外 9할 이상은 에

            e.printStackTrace();//안에 내용정확하지 않다는 뜻 

            System.out.println("年齢が正しくありません。");

        }

        

    }


}