代码改变世界

[Java in NetBeans] Lesson 07. JavaDoc and Unit Tests

2018-12-14 04:50  Johnson_强生仔仔  阅读(214)  评论(0编辑  收藏  举报

这个课程的参考视频和图片来自youtube

    主要学到的知识点有:

1. organize code into packages

Create a package if want to make the jar file reusable for other projects too. 

2. JavaDocs- document the code

In NetBeans Shortcut : /**  == generate JavaDoc for method

/**
 *  Print the message
 *  @param message Message need to print
 */
public void printMessage(String message)
{
        System.out.println(message);

}

In NetBeans Shortcut : Ctl + Space  == invodke JavaDoc for method

3. Test java methods with Junit

  • Reduce the probability of semantic errors. 
  • Source Packages, right click, New, other, Unit Tests, Test for Existing Class.
  • In NetBeans Shortcut : Ctl + F6  == Run Unit Tests.