1. 程式人生 > >[Java in NetBeans] Lesson 07. JavaDoc and Unit Tests

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

這個課程的參考視訊和圖片來自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.