
public class Hello {
public static void main(String[] args) {
byte b = 1;
// true는 예약어이지만 True는 예약어가 아님
System.out.println(b);
// 실행하기전 항상 저장하여 실행하기
// ctrl + f11 누르면 자동 실행
// ctrl + d 누르면 한 줄 자동으로 지워짐
short s = -50;
System.out.println(s);
int i = 999;
/*이렇게 하면
여러 줄로 주석을 달 수 있음
매우 유용함*/
// alt + 방향키 위: 줄 이동
// ctrl + alt + 방향키 아래 복사
System.out.println(i);
long l = 9999999999L;
// long 자료형의 값을 사용할 때는 뒤에 대문자나 소문자 L을 접미사로 붙여야함.
System.out.println(l);
float f = 0.25F;
// 실수는 자바에서 기본으로 double 형으로 이해함
// 따라서 소문자나 대문자f 를 접미사로 붙여야 함.
double d = 0.75;
System.out.println(f);
System.out.println(d);
System.out.println("------------");
char c = 'A';
String str = "Hello, World";
// 참조 자료형은 첫글자가 무조건 대문자로 시작함
// 안에서 열린 것 먼저 닫아야함 {()} 이런식으로
// {(}) 이런식은 ---> XXX
System.out.println(c);
System.out.println(str);
final char CSTR;
// 상수는 무조건 대문자로 작성함
c = 'Z';
CSTR = 'A';
System.out.println(c);
System.out.println(CSTR);
}
}

public class Hello2 {
static char c;
static final char CSTR;
// 오류가 남 먼저 값을 할당해주어야함
static final char CST = 'A';
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
상수를 main 전에 선언할 때는 미리 값을 선언(초기화) 해주어야함.
변수는 그냥 선언할 수 있음.

public class Hello3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
char c;
c = 'Z';
int c = 5;
// 변수명은 겹치게 사용할 수 없음
// 식별자이기 때문
System.out.println(c);
}
}
위의 코드에서 변수명을 c로 두번 선언해 주었기 때문에 오류 발생!
똑같은 변수명은 선언해 줄 수 없음
자료형이 달라도 안됨.