package com.hanqi; public class JiaoSe { //角色性别 String JueSeXingBie; //服装颜色 String FuZhuangYanSe; //角色职业 String ZhiYe; //角色任务 String DangQianRenWu; public void renWu(String zhixingrenwu) { DangQianRenWu += zhixingrenwu; System.out.println("这次设定:" + FuZhuangYanSe +"服装的" + JueSeXingBie +ZhiYe +",执行" + zhixingrenwu +"。"); } }
package com.hanqi; public class shuchu { public static void main(String[] args) { JiaoSe cike = new JiaoSe(); cike.JueSeXingBie ="女性"; cike.FuZhuangYanSe ="水蓝色"; cike.ZhiYe ="刺客"; cike.renWu("刺杀皇帝任务"); } }
输出程序为:
这次设定:水蓝色服装的女性刺客,执行刺杀皇帝任务。