|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#5
|
||||
|
||||
|
Re: Method From ColorImage
No, because you can only downcast an object if it was that type to begin with.
Code:
class A {}
class B extends A {}
public static void main(String[] args){
A a1 = new B();
B a1_b = (B) a1; // ok
A a2 = new A();
B a2_b = (B) a2; // ClassCastException
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|