반응형
# 주석 (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");
반응형
'알고리즘 > 프로그래머스, 백준, 구름' 카테고리의 다른 글
[구름] break, continue (0) | 2020.11.09 |
---|---|
[구름] 연산의 우선순위 (0) | 2020.11.08 |
백준 2869 달팽이는 올라가고 싶다 자바 (0) | 2020.10.29 |
백준 1712 손익분기점 자바 (0) | 2020.10.28 |
백준 1316 그룹 단어 체커 자바 (0) | 2020.10.28 |