当前位置: 代码迷 >> J2SE >> 这个程序为什么不能运行?解决思路
  详细解决方案

这个程序为什么不能运行?解决思路

热度:308   发布时间:2016-04-24 01:37:04.0
这个程序为什么不能运行?
Java编程思想第4版中的一个例子, 为何不能运行?
执行时一直挂在那,没输出。

PS D:\java\source> javac annotations/AtUnitExample1.java
PS D:\java\source> java annotations/AtUnitExample1

Java code
//: annotations/AtUnitExample1.javapackage annotations;import net.mindview.atunit.*;import net.mindview.util.*;public class AtUnitExample1 {  public String methodOne() {    return "This is methodOne";  }  public int methodTwo() {    System.out.println("This is methodTwo");    return 2;  }  @Test boolean methodOneTest() {    return methodOne().equals("This is methodOne");  }  @Test boolean m2() { return methodTwo() == 2; }  @Test private boolean m3() { return true; }  // Shows output for failure:  @Test boolean failureTest() { return false; }  @Test boolean anotherDisappointment() { return false; }  public static void main(String[] args) throws Exception {    OSExecute.command(      "java net.mindview.atunit.AtUnit AtUnitExample1");  }} /* Output:annotations.AtUnitExample1  . methodOneTest  . m2 This is methodTwo  . m3  . failureTest (failed)  . anotherDisappointment (failed)(5 tests)>>> 2 FAILURES <<<  annotations.AtUnitExample1: failureTest  annotations.AtUnitExample1: anotherDisappointment*///:~




------解决方案--------------------
为什么不用 IDE ?
------解决方案--------------------
自己解决了不是更好吗?
这样就更清楚编译器在做些什么了
  相关解决方案