주석
주석(comment)은 로직에 대한 설명이나 코드를 비활성화 할 때 사용한다. 주석은 프로그래밍적으로 해석되지 않는다.
한줄 주석
public static void main(String[] args) { // 두개의 변수가 같은 데이터 타입 일 때 아래와 같이 코드를 작성한다. String a, b; }
여러줄 주석
public static void main(String[] args) { String a, b; /* a = "coding"; b = "everybody"; System.out.println(a+b); */ }
/** * 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(); } }
// assignment statement aValue = 8933.234; // increment statement aValue++; // method invocation statement System.out.println("Hello World!"); // object creation statement Bicycle myBike = new Bicycle();
int a = 100; double b = 10.1;