디케이
주석문 본문
반응형
주석문
주석이란, 프로그램의 코드와 실행에는 영향을 주지 않는 문장주석의 종류
-
구현 주석
- 행단위 주석 (// 를 해주면, 해당 행이 주석 처리됨 )
- 블럭단위 주석 (/* 주석으로 사용할 내용 */ )
-
문서화 주석
- /** 문서에 포함할 내용을 작성함 */
- 문서화 주석은 클래스, 인터페이스 그리고 멤버 당 하나씩 가질 수 있고, 선언 바로 전에 작성
- 문서화 주석 예
import java.io.*;
/**
* <h1>Add Two Numbers!</h1>
* The AddNum program implements an application that
* simply adds two given integer numbers and Prints
* the output on the screen.
* <p>
* <b>Note:</b> Giving proper comments in your program makes it more
* user friendly and it is assumed as a high quality code.
*
* @author Zara Ali
* @version 1.0
* @since 2014-03-31
*/
public class AddNum {
/**
* This method is used to add two integers. This is
* a the simplest form of a class method, just to
* show the usage of various javadoc Tags.
* @param numA This is the first paramter to addNum method
* @param numB This is the second parameter to addNum method
* @return int This returns sum of numA and numB.
*/
public int addNum(int numA, int numB) {
return numA + numB;
}
/**
* This is the main method which makes use of addNum method.
* @param args Unused.
* @return Nothing.
* @exception IOException On input error.
* @see IOException
*/
public static void main(String args[]) throws IOException
{
AddNum obj = new AddNum();
int sum = obj.addNum(10, 20);
System.out.println("Sum of 10 and 20 is :" + sum);
}
}
반응형
'Java' 카테고리의 다른 글
상수 (0) | 2020.10.17 |
---|---|
변수 (0) | 2020.10.17 |
기본 입/출력 메소드 명령어 정리 (0) | 2020.10.17 |
게시판 연습(if문 제거 & for문 자동완성 적용) (0) | 2020.10.16 |
github에서 당겨 오기 (0) | 2020.10.15 |