Changes

Jump to navigation Jump to search
530 bytes added ,  09:54, 3 April 2015
no edit summary
Line 275: Line 275:  
protected → can only be by the class where it was declarated, subclasses and from it's package.<br />
 
protected → can only be by the class where it was declarated, subclasses and from it's package.<br />
 
no access specifier → only accesible from the same package.<br />
 
no access specifier → only accesible from the same package.<br />
 +
 +
== Polymorphism ==
 +
You can point a variable of a parent type to a child type, it will have the methods from it's type but overriden by the subclass.<br />
 +
You wont be able to call methods from the subclass that are not implemented on the variable type.
 +
Example files:
 +
[https://github.com/rafahsolis/javaTutorial/blob/master/Polymorphism.java Polymorphism.java]<br />
 +
[https://github.com/rafahsolis/javaTutorial/blob/master/Plant.java Plant.java]<br />
 +
[https://github.com/rafahsolis/javaTutorial/blob/master/Tree.java Tree.java]
    
== Eclipse shortcuts ==
 
== Eclipse shortcuts ==

Navigation menu