class Cust{ String name; int ID; String PWD; int money; Cust(String newName,int newID,String newPWD,int newMoney){ name = newName; ID = newID; PWD = newPWD; money = newMoney; } void getMoney(int newMoney){ money = money - newMoney; } void setMoney(int newMoney){ money = money + newMoney; } void search(){ System.out.println("户名:" + name); System.out.println("账号:" + ID); System.out.println("账户余额:" + money); } void changePWD(String newPWD){ PWD = newPWD; } } class MainDemo{ public static void main(String[] args){ Cust myCust = new Cust("Tom",100,"11111",10000); myCust.setMoney(5000); myCust.getMoney(3000); myCust.changePWD("Tom"); myCust.search(); } }
·了解了编码方式,并学会了怎么修改,下载并安装了eclipse。
·学会了对象的使用。
·this调用本类方法????
时间: 2024-10-13 11:17:42