随笔分类 -  Java

摘要: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 阅读(166) 评论(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 阅读(157) 评论(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 阅读(1672) 评论(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 阅读(139) 评论(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 阅读(232) 评论(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 阅读(267) 评论(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 阅读(1165) 评论(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 阅读(335) 评论(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 阅读(4846) 评论(0) 推荐(0)
摘要://例1——实例方法能够被覆盖 class Super{ String name(){ return "mother"; } } class Sub extends Super{ String name(){ return "baby"; } }... 阅读全文
posted @ 2015-09-20 22:58 iucforever 阅读(157) 评论(0) 推荐(0)
摘要:问题: 将一个数字与数组中的元素比较, 如果该数字存在数组中,给出该数字在数组中的位置; 如果该数字不在数组中,给出提示。 代码: public class Page84{ public static void main(String args[]){ int Num = 12; int Num... 阅读全文
posted @ 2015-09-20 00:11 iucforever 阅读(340) 评论(0) 推荐(0)