Skip to main content
Array Declarations
- Arrays can hold primitives or objects, but the array itself is always an object.
- When you declare an array, the brackets can be to the left or right of thevariable name.
- It is never legal to include the size of an array in the declaration.
- An array of objects
can hold any object that passes the IS-A (or instanceof) test for the
declared type of the array. For example, if Horse extends Animal, then a
Horse object can go into an Animal array. Static Variables and Methods
- They are not tied to any particular instance of a class.
- No classes instances are needed in order to use static members of the class.
- There is only one copy of a static variable / class and all instances share it.
- static methods do not have direct access to non-static members.