0
내가 가진 -ClassCastException이 모험
class A {
// contains certain set() and get() methods
}
class B extends A {
public A getAotherMethod() {
A a = new A();
// Contains some logic
return a
}
}
class C extends B {
// contains certain set() and get() methods
}
class D {
public Object getMethod() {
B b = new B();
// Contains some logic
return b.getAnotherMethod()
}
}
public static void main(String[] args) {
A a = new A();
B b = new B();
C c = new C();
D d = new D();
c = (C) d.getMethod(); // This is giving me ClassCastException
}
"나는 차를 가지고있다. 내가 벽을 몰 때 갈라진다." – Ingo