Java第四周常用类与集合框架上机实验一接口+抽象类

(http://img.blog.csdn.net/20150907112946909)


第一题:
1package test9_7;

public abstract class InterfaceTest_phone implements  InterfaceTest {

//  String phoneaction="手机";
    String phoneaction ;
    public void takepicture() {
        System.out.println("*********");
        System.out.println("抽象类的InterfaceTest_phone的takepicture()方法中");
        System.out.println("¥¥¥¥¥¥¥¥¥¥¥¥");
    }
    public void picture(String stype) {
        this.phoneaction=stype;
        System.out.println("这款手机的照相作业是:"+this.phoneaction);

    }
    public abstract void photo();
}
2package test9_7;

public interface InterfaceTest {

    String action="照相";
    public void takepicture();
    public void picture(String stype);
}




3package test9_7;

public   class InterfaceTest_picturephone extends InterfaceTest_phone implements  InterfaceTest   {
   public static String picture="高像素小清新拍照手机";
    public static void main(String[] args){
        InterfaceTest_picturephone picturephone=new InterfaceTest_picturephone();

        picturephone.takepicturetest();
        picturephone.picture(picture); 
        System.out.println("这时候的功能主要是:"+action);
        System.out.println("");
        picturephone.takepicture();
        picturephone.picture("手机");

    }

    public void takepicturetest() {
        System.out.println("%%%%%%%%%%%%%%%%%");
        System.out.println(" 类的InterfaceTest_picturephone的takepicture()方法中");
        System.out.println("&&&&&&&&&&……………………&&&&&&&");
    }

    public  void photo(){

    }


}




发布了347 篇原创文章 · 获赞 15 · 访问量 6万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 终极编程指南 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览