摘要:
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 "... 阅读全文