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(" 名字:%s,价格:%d,护甲值:%d",szj.name,szj.price,szj.ac); } } class Item { String name; int price; } class Armor extends Item{ int ac;//护甲等级 }