首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-03-21 
这个程序为什么不能运行?Java编程思想第4版中的一个例子, 为何不能运行?执行时一直挂在那,没输出。PS D:\ja

这个程序为什么不能运行?
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 ?
[解决办法]
自己解决了不是更好吗?
这样就更清楚编译器在做些什么了

热点排行