免费织梦网站源码下载广告投放怎么做
随时随地技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(ydmsq666)
package com;public class Cleaner {public int price;public Cleaner(int price) {this.price = price;}public void clean() {System.out.println("可以去污");}public static void main(String[] args) {Soap s = new Soap();System.out.println("肥皂的价格:" + s.price);s.clean();s.shape();WashingPowder p = new WashingPowder();System.out.println("洗衣粉的价格:" + p.price);p.clean();p.shape();}}class Soap extends Cleaner {public Soap() {super(5);}public void shape() {System.out.println("呈块状");}
}class WashingPowder extends Cleaner {public WashingPowder() {super(10);}public void shape() {System.out.println("呈粉末状");}
}