导出类--是子类的意思吧?!- class Person
- {
- void print(int i)
- {
- System.out.println(i);
- }
- void print(int i,int j)
- {
- System.out.println(i+j);
- }
- }
- class Student extends Person
- {
- public void print(int i,int j)
- {
- System.out.println(i-j);
- }
- }
- class Test
- {
- public static void main(String [] args) throws Exception
- {
- Student s = new Student();
- s.print(8,5);//输出:3
- s.print(0);//输出:0
- }
- }
复制代码 |