继承练习
作者:互联网
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;//护甲等级 }
标签:szj,ac,name,继承,price,练习,bj,Armor 来源: https://www.cnblogs.com/lsswudi/p/11295618.html