[問題] extends inner class
public class Circle {
class Point {
public int x = 5, y = 2;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return x + ", " + y;
}
}
}
public class Test extends Circle.Point {
public Test() {
System.out.println(toString());
}
}
compile的時候出現這個錯誤
Test.java:2: an enclosing instance that contains Circle.Point is required
public Test() {
^
1 error
請問是無法繼承inner class嗎?
新手JAVA首PO
請多指教
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.210.186
推
06/10 22:11, , 1F
06/10 22:11, 1F
→
06/10 22:12, , 2F
06/10 22:12, 2F
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 3 篇):
java 近期熱門文章
3
14
PTT數位生活區 即時熱門文章