标签:
public class renwu { public static void main(String[] args) { XiYouJiRenWu renwu1 = new XiYouJiRenWu(); renwu1.name="孙悟空"; renwu1.wuqi="金箍棒"; renwu1.printName(); renwu1.printWuqi(); XiYouJiRenWu renwu2 = new XiYouJiRenWu(); renwu2.name="猪八戒"; renwu2.wuqi="铁钉耙"; renwu2.printName(); renwu2.printWuqi(); } }
public class XiYouJiRenWu { String name; String wuqi; void printName() { System.out.println("西游记人物"+name); } void printWuqi() { System.out.println("使用的武器是"+wuqi); } }
标签:
原文地址:http://www.cnblogs.com/zhailiming/p/5498454.html