publicvoiddoSleep() { System.out.println("Bill usually goes to bed at nine"); } publicstaticvoidmain(String[] args) { newMike().doSomething(); newBill().doSleep(); } }
先執行看看會得到錯誤
1 2 3 4 5 6 7 8
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature at com.github.usermark.Bill.main(Bill.java:10) Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.Signature at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 1 more
prepare exec com.github.usermark.Mike.doSomething Mike likes to play sports Bill usually goes to bed at nine already exec com.github.usermark.Bill.doSleep
prepare exec com.github.usermark.Mike.doSomething Mike likes to play sports already exec com.github.usermark.Mike.doSomething Bill usually goes to bed at nine already exec com.github.usermark.Bill.doSleep
prepare exec com.github.usermark.Mike.doSomething Mike likes to play sports already exec com.github.usermark.Mike.doSomething prepare exec com.github.usermark.Bill.doSleep Bill usually goes to bed at nine already exec com.github.usermark.Bill.doSleep