[問題] java新手問題
最近在看書後試著自己打了一個結果沒辦法跑
但是編譯通過了
希望各位高手可以幫我看一下!
class C {
private int i;
public void setInfo(int i) {
this.i = i;
}
public int getInfo() {
return i;
}
}
class D extends C {} // 類別 D 繼承類別 C
class Ex6_2_1 {
public static void main(String[] args) {
D d = new D();
d.setInfo(10);
System.out.println("The value of d is: "+d.getInfo());
}
}
錯誤訊息:
exception in thread "main" java.lang.NoClassDefFoundError:ex6_2_1
caused by:......
could not find the main class:ex6_2_1. program will exit.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.22.18.56
→
02/04 01:21, , 1F
02/04 01:21, 1F
→
02/04 01:52, , 2F
02/04 01:52, 2F
→
02/04 02:11, , 3F
02/04 02:11, 3F
→
02/04 07:59, , 4F
02/04 07:59, 4F
→
02/04 13:28, , 5F
02/04 13:28, 5F
→
02/04 13:32, , 6F
02/04 13:32, 6F
→
02/04 15:13, , 7F
02/04 15:13, 7F
→
02/05 00:29, , 8F
02/05 00:29, 8F
→
02/05 00:31, , 9F
02/05 00:31, 9F
→
02/05 00:57, , 10F
02/05 00:57, 10F
→
02/05 01:37, , 11F
02/05 01:37, 11F
推
02/05 15:15, , 12F
02/05 15:15, 12F
推
02/05 15:46, , 13F
02/05 15:46, 13F
→
02/05 20:11, , 14F
02/05 20:11, 14F