继承练习

public class lolweapon {
	public static void main(String[] args) {
		Armor bj = new Armor();
		bj.name = "布甲";
		bj.price = 300;
		bj.ac = 15;
		Armor szj = new Armor();
		szj.name = "锁子甲";
		szj.price = 500;
		szj.ac = 40;
		System.out.printf("名字:%s,价格:%d,护甲值:%d",bj.name,bj.price,bj.ac);
		System.out.printf("\n名字:%s,价格:%d,护甲值:%d",szj.name,szj.price,szj.ac);
	}
}
 class Item {
	String name;
	int price;
}
 class Armor extends Item{
	int ac;//护甲等级
}

 

上一篇:GPG(GnuPG)加密


下一篇:day19类作业