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
반응형
'study > Java' 카테고리의 다른 글
[Java] 1 ~ 5. TEST2 풀이 (0) | 2022.03.10 |
---|---|
[Java] 1 ~ 5. TEST1 풀이 (0) | 2022.03.10 |
[Java] 1 ~ 5. TEST1 (0) | 2022.03.10 |
[Java] 5. 식별자 정의규칙 및 권장사항 (0) | 2022.03.10 |
[Java] 4. 형변환 예제, 리터널 사용 접미사 (double, float, long) (0) | 2022.03.10 |