摘要:
import java.util.*; public class Test{ public static void main(String[] args) { List list=new ArrayList(); list.add("Hello"); list.add("World"); list.add("HAHAHAHA"); //第一... 阅读全文
摘要:
public class Person { private String name; private int age; } public class Person{ private String name; private int age; public int getAge(){ return age; } pub... 阅读全文
摘要:
public abstract class Employee { private String name; private String address; private int number; public Employee(String name, String address, int number) { System.out.println("C... 阅读全文
摘要:
Parent p = new Child(); public class Test { public static void main(String[] args) { show(new Cat()); // 以 Cat 对象调用 show 方法 show(new Dog()); // 以 Dog 对象调用 show 方法 ... 阅读全文
摘要:
class Animal{ public void move(){ System.out.println("动物可以移动"); } } class Dog extends Animal{ public void move(){ System.out.println("狗可以跑和走"); } } public class TestDog{ ... 阅读全文