package com.edu.test;
public class Account {
private String id;
private String passwd;
private int money;
private static int num = 0;
public static int count = 0; // 클래스 변수
public Account() {
count++;
num++; }
public Account(String _id, String _passwd)
{
this.id = _id;
this.passwd = _passwd;
this.money = 0;
count++;
num++;
}
public Account(String _id, String _passwd, int _money)
{
this.id = _id;
this.passwd = _passwd;
this.money = _money;
count++;
num++;
}
public String getId()
{
return this.id;
}
public void setId(String _id)
{
this.id = _id;
}
public void depositmoney (int money)
{
this.money += money;
}
public boolean withdrawmoney (int money)
{
int remainmoney = 30;
if (this.money
return false;
this.money -= money;
return true;
}
public int querymoney()
{
return this.money;
}
public void print(int num)
{
for(int i = 0; i
{
System.out.println(this.id+":"+num+":"+i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
this.id ="hello";
}
public int getnum() {
return num;
}
-------------------------------------------
}
댓글 0