String input="5.2", output;

Double ans = 0;

 

ans=Double.parseDouble(input);

//if input is not String type, it throws NumberFormatException error

//만일 input이 String Type이 아니면 NumberFormatExecption error를 발생시킨다.

//if input is null, it throws NullpointException error

//만일 input이 Null이면 NullpointException error를 발생시킨다.

함수는 Double형을 반환한다.

 

output=Double.toString(ans*2);

//ans*2의 값을 ASCII의 형태의 문자열로 반환한다.

 

Toast.makeText(MainActivity.this, output, Toast.LENGTH_SHORT).show();

//안드로이드에서 간단한 문자열(output)로 화면에 표시

 

10.4

 

 

+ Recent posts