随笔分类 - Java
摘要:package snippet; import intfa.Person; import intfa.soninfo.Son;; public class Test02{ public static void main(String[] args) { Person a = new Person(); ...
阅读全文
摘要:abstract class Animal{ public abstract void eat(); } class Dog extends Animal{ public void eat(){ System.out.println("狗吃骨头"); } } ...
阅读全文
摘要://多态的应用 class Animal{ public void eat(){ } } class Dog extends Animal{ public void eat(){ System.out.println("狗吃骨头"); } } class Cat exte...
阅读全文
摘要:class Test02 { public static void main(String args[]){ final int x; x = 100; //x = 200; System.out.println(x); ...
阅读全文
摘要:class Animal{ public final void eat(){ System.out.println("吃"); } } class Dog extends Animal{ public void eat(){ System.out...
阅读全文
摘要:class Base{ int x = 1; static int y = 2; String name(){ return "mother"; } static String staticname(){ return "...
阅读全文
摘要:// 静态方法不能被覆盖 /*class Super{ static String name(){ return "mother"; } } class Test02{ public static void main(String[] args){ Super s3 = new Super()...
阅读全文
摘要:class Base{ int x = 1; static int y = 2; } class Subclass extends Base{ int x = 4; int y = 5; } public class Test02{ ...
阅读全文
摘要:class Base{ int x = 1; static int y = 2; String name(){ return "mother"; } static String staticname(){ return "...
阅读全文
摘要://例1——实例方法能够被覆盖 class Super{ String name(){ return "mother"; } } class Sub extends Super{ String name(){ return "baby"; } }...
阅读全文
摘要:问题: 将一个数字与数组中的元素比较, 如果该数字存在数组中,给出该数字在数组中的位置; 如果该数字不在数组中,给出提示。 代码: public class Page84{ public static void main(String args[]){ int Num = 12; int Num...
阅读全文

浙公网安备 33010602011771号