scjp
Java
code posted
created at 10 Apr 17:14
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
class Mammal { String name = "furry "; String makeNoise() { return "generic noise"; } } class Zebra extends Mammal { String name = "stripes "; String makeNoise() { return "bray"; } } public class ZooKeeper { public static void main(String[] args) { new ZooKeeper().go(); } void go() { Mammal m = new Zebra(); System.out.println(m.name + m.makeNoise()); } } |
394 Bytes in 2 ms with coderay