Casting between ArrayLists in Java

后端 未结 6 638
故里飘歌
故里飘歌 2020-12-15 11:56

Sorry, I thought this was an inheritance question: it was an ArrayList question all along!

Ok, my problem is more specific than I thought. So I have two families of

6条回答
  •  孤城傲影
    2020-12-15 12:40

    This is going to depend on what the access control is on the Arraylist in Zonelist. My assumption from the debugger statement is that it is either unmarked, public, or protected. A subclass can "Hide" a parent class' variable it has access to by defining a variable with the same name. You can also use this keyword to refer to the particular object instance and super keyword to refer to the parent.

    Here is a good link on basic access control in Java:

    http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html

    This you might also find helpful

    http://java.sys-con.com/node/46344

提交回复
热议问题