CS 2110 Lecture 6: Types and Their consequences, instanceof
Document Summary
Lecture 6 - types and their consequences, instanceof. Given a method/class/anything inside some other class/method/anything, the outer thing has access to any component inside it. Values of linked lists are probably of class object. What does the mean? whatever type can be added to the list! You put in integer or string or. This creates an array with 3 elements, each whose type must be animal. The array is also of type animal[] Stores a new object type of animal at index 0 in array v. Can call methods on these objects still. We have two variables that point towards the same object. For both objects, we still must use the bottom up rule! You cannot call a method that is not available in either animal or one of its superclasses. Suppose a refers to an object of. Rule for determining legality of method call.