标签:
package com.hanqi; public class XiYouJiRenWu { double height; String name; String weapon; void printName() { System.out.println("这个是"+name); } void printWeapon() { System.out.println(name+"的武器是"+weapon); } }
public static void main(String[] args) { // TODO 自动生成的方法存根 XiYouJiRenWu XiYouJiRenWu1=new XiYouJiRenWu(); XiYouJiRenWu1.name="孙悟空"; XiYouJiRenWu1.weapon="如意金箍棒"; XiYouJiRenWu1.printName(); XiYouJiRenWu1.printWeapon(); XiYouJiRenWu XiYouJiRenWu2=new XiYouJiRenWu(); XiYouJiRenWu2.name="猪八戒"; XiYouJiRenWu2.weapon="九齿钉耙"; XiYouJiRenWu2.printName(); XiYouJiRenWu2.printWeapon(); }
标签:
原文地址:http://www.cnblogs.com/jskbk/p/5497555.html