반응형

# 주석 (Comment)

  • 로직에 대한 설명, 코드를 비활성화 할 때 사용한다.
  • 주석은 프로그래밍적으로 해석되지 않는다.
1. 한줄 주석
public static void main(String[] args) {

	// 주석 입니다.
    int a;
}


2. 여러줄 주석
public static void main(String[] args) {

	/* 여러줄 주석 입니다.
    
    int a;
    
    */
}


3. JavaDoc 주석
- 주석이면서 동시에 자바의 api 문서를 만드는 규약이 있다.

/**

* Prints an integer and then terminate the line. This method behaves as

* though it invokes <code>[@link #print(int)}</code> and then

* <code>{@link #println()}</code>

*

* @param x The <code>int</code> to be printed.

*/

public void println(int x) {
	synchronized (this) {
    	print(x);
        
        newLine();
    }
}

# 세미콜론 (statement)

  • 문장의 끝을 의미한다.
  • 자바에서는 문장의 끝에 세미콜론을 사용하지 않으면 컴파일 에러가 발생한다.
int a = 10;

int k = 5; int b = 12;

System.out.println("Hello World");
반응형

+ Recent posts