当前位置:首页 > 开发 > 编程语言 > Java > 正文

java 实现多重继承

发表于: 2013-07-27   作者:cuityang   来源:转载   浏览:
摘要: package com.yangll; //多重继承类 public class ClassTestylll extends Person1 { class inner extends Machine1{ @Override void run() { // TODO Auto-generated method stub System.out.println(&quo
package com.yangll;

//多重继承类
public class ClassTestylll extends Person1 {

class inner extends Machine1{
@Override
void run() {
// TODO Auto-generated method stub
System.out.println("Machine1 is run");
}
}

public void run1(){
this.run();
}
public void run2(){
new inner().run();
}

public void run3(ClassTestylll a){
a.run();
}
public void run4(inner b){
b.run();
}

public inner getInner(){
return new inner();
}

public static void main(String[] args){
ClassTestylll t = new ClassTestylll();
t.run1();
t.run2();

t.run3(t);
t.run4(t.getInner());
}
}

class Person1{
public void run(){System.out.println("Persion1 is run");};
}

abstract class Machine1{
abstract void run();
}

java 实现多重继承

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号