沒有提供無引數建構子
當你自己寫建構子時,就不會自動產生預設建構子了
※ 引述《tobyzi.bbs@bbs.wretch.cc (toby)》之銘言:
> public class Q8 extends Q7
> {
> public static void main(String[] args)
> {
> Q7 q1=new Q7(10);
> System.out.println(q1.i);
> }
> }
> class Q7
> {
> int i;
> public Q7(int i)
> {
> this.i=i;
> }
> }
> 以上是我的程式碼
> = = = = = = = = = = = = = = =
> 以下錯誤信息, 請指教謝謝!
> D:\temp>javac Q8.java
> Q8.java:1: cannot find symbol
> symbol : constructor Q7()
> location: class Q7
> public class Q8 extends Q7
> ^
> 1 error
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: pc210-59-94-179.nutn.edu.tw
討論串 (同標題文章)