摘要: package snippet; import intfa.Person; import intfa.soninfo.Son;; public class Test02{ public static void main(String[] args) { Person a = new Person(); ... 阅读全文
posted @ 2015-09-22 22:26 iucforever 阅读(157) 评论(0) 推荐(0) 编辑
摘要: abstract class Animal{ public abstract void eat(); } class Dog extends Animal{ public void eat(){ System.out.println("狗吃骨头"); } } ... 阅读全文
posted @ 2015-09-22 22:25 iucforever 阅读(146) 评论(0) 推荐(0) 编辑
摘要: //多态的应用 class Animal{ public void eat(){ } } class Dog extends Animal{ public void eat(){ System.out.println("狗吃骨头"); } } class Cat exte... 阅读全文
posted @ 2015-09-22 22:22 iucforever 阅读(1660) 评论(0) 推荐(0) 编辑
摘要: class Test02 { public static void main(String args[]){ final int x; x = 100; //x = 200; System.out.println(x); ... 阅读全文
posted @ 2015-09-22 22:21 iucforever 阅读(135) 评论(0) 推荐(0) 编辑
摘要: class Animal{ public final void eat(){ System.out.println("吃"); } } class Dog extends Animal{ public void eat(){ System.out... 阅读全文
posted @ 2015-09-22 22:20 iucforever 阅读(212) 评论(0) 推荐(0) 编辑
摘要: class Base{ int x = 1; static int y = 2; String name(){ return "mother"; } static String staticname(){ return "... 阅读全文
posted @ 2015-09-22 12:42 iucforever 阅读(257) 评论(0) 推荐(0) 编辑
摘要: // 静态方法不能被覆盖 /*class Super{ static String name(){ return "mother"; } } class Test02{ public static void main(String[] args){ Super s3 = new Super()... 阅读全文
posted @ 2015-09-22 12:42 iucforever 阅读(1147) 评论(0) 推荐(0) 编辑
摘要: class Base{ int x = 1; static int y = 2; } class Subclass extends Base{ int x = 4; int y = 5; } public class Test02{ ... 阅读全文
posted @ 2015-09-22 12:41 iucforever 阅读(327) 评论(0) 推荐(0) 编辑
摘要: class Base{ int x = 1; static int y = 2; String name(){ return "mother"; } static String staticname(){ return "... 阅读全文
posted @ 2015-09-22 12:40 iucforever 阅读(4803) 评论(0) 推荐(0) 编辑