1. 使用assert , 必須在java 后使用參數-ea
java -ea HelloWorld
2. 所以在eclipse中, 選擇run... 然后設置jvm參數-ea就ok了
注:assert的條件為假時觸發。