I have read up the concept of what you said. However, I want to know if 'a' can reference a J_SubClass or not. And why ? That's the key.
Type: Posts; User: CheukKwan
I have read up the concept of what you said. However, I want to know if 'a' can reference a J_SubClass or not. And why ? That's the key.
Why can my code be compiled ? And why can't J_SuperClass be cast to J_SubClass ?:confused:
2393
The following is my code:
class J_SuperClass {
}
class J_SubClass extends J_SuperClass {
}
public class Son extends Base {
private int i = 22; //12
{
System.out.println("private int i = "+i); //13
}
public Son() { //3
i = 222; //14
System.out.println("i: " + i);...
Hi ! I'm new here.I have a question.I don't konw why the value of ' i' is 0;And the following is my code. Thx.
public class TestDemo {
public static void main(String[] args) {
new Son();...