반응형
Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

디케이

주석문 본문

Java

주석문

디케이형 2020. 10. 17. 16:45
반응형

주석문

주석이란, 프로그램의 코드와 실행에는 영향을 주지 않는 문장주석의 종류

  • 구현 주석

    • 행단위 주석 (// 를 해주면, 해당 행이 주석 처리됨 )
    • 블럭단위 주석 (/* 주석으로 사용할 내용 */ )
  • 문서화 주석

    • /** 문서에 포함할 내용을 작성함 */
    • 문서화 주석은 클래스, 인터페이스 그리고 멤버 당 하나씩 가질 수 있고, 선언 바로 전에 작성
    • 문서화 주석 예
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