This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
java:hiding_static_methods [2015/02/15 17:40] gthanos |
java:hiding_static_methods [2015/03/01 19:22] gthanos |
||
---|---|---|---|
Line 29: | Line 29: | ||
public static void main(String[] args) { | public static void main(String[] args) { | ||
Cat myCat = new Cat(); | Cat myCat = new Cat(); | ||
- | Animal myAnimal = myCat; | + | Animal myAnimalCat = myCat; |
- | Animal yourAnimal = new Animal(); | + | Animal myAnimal = new Animal(); |
| | ||
Animal.testClassMethod(); | Animal.testClassMethod(); | ||
Line 37: | Line 37: | ||
System.out.println(""); | System.out.println(""); | ||
+ | myAnimalCat.testClassMethod(); | ||
myAnimal.testClassMethod(); | myAnimal.testClassMethod(); | ||
- | yourAnimal.testClassMethod(); | ||
myCat.testClassMethod(); | myCat.testClassMethod(); | ||
Line 44: | Line 44: | ||
| | ||
myCat.testInstanceMethod(); | myCat.testInstanceMethod(); | ||
+ | myAnimalCat.testInstanceMethod(); | ||
myAnimal.testInstanceMethod(); | myAnimal.testInstanceMethod(); | ||
- | yourAnimal.testInstanceMethod(); | ||
} | } | ||
} | } |