Search:

Type: Posts; User: CheukKwan

Search: Search took 0.10 seconds.

  1. Replies
    5
    Views
    905

    Re: About casting

    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.
  2. Replies
    5
    Views
    905

    About casting

    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 {
    }
  3. Replies
    2
    Views
    1,060

    Re: Why the value of ' i' is 0;

    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);...
  4. Replies
    2
    Views
    1,060

    Why the value of ' i' is 0;

    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();...
Results 1 to 4 of 4