정보/Java

변수

여기블로그 2022. 12. 15. 21:21
728x90
반응형

//정수형 변수
int i = 100;


//실수형 변수
float f=3.14f;

double d = 3.14;


//문자형 변수

char c = 'c';


//문자열 변수

String s = "hello";


//논리형 변수
boolean b = true;


System.out.println(i); // 값=100
System.out.println(f); // 값=3.14
System.out.println(d); // 값=3.14
System.out.println(c); // 값=c
System.out.println(s); // 값=hello
System.out.println(b); // 값=true

728x90
반응형