본문 바로가기
study/Java

[Java] 1 ~ 5. TEST2

by 금이패런츠 2022. 3. 10.
728x90
반응형
package chap2;
/*
6. 다음결과가 나오도록 Test2 프로그램 수정하기
결과 :
c=30
ch=C
f=1.5
l=27000000000
result=true 
*/
public class Test2 {
	public static void main(String[] args) {
		   byte a = 10;
		   byte b = 20;
		   byte c = a + b; 
		   char ch = 'A';
		   ch = ch + 2;
		   float f = 3 / 2;
		   long l= 3000 * 3000 * 3000;
		   float f2 = 0.1f;
		   double d = 0.1;
		   boolean result = d==f2;
		   System.out.println("c="+c);
		   System.out.println("ch="+ch);
		   System.out.println("f="+f);
		   System.out.println("l="+l);
		   System.out.println("result="+result);
	}
}
728x90
반응형