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;

}

-------------------------------------------

}



package com.edu.test;

public class AccountManager {

public static void main(String[] args) {
// TODO Auto-generated method stub
Account acc1 = new Account();
Account acc2 = new Account("qwas","1234");
Account acc3 = new SpecialAccount();
//acc3.depositmoney(1000);
//acc3.setId("hong");
//acc3.print();
//System.out.println("count:"+ acc1.count);

System.out.println(acc1.getnum());  
System.out.println(acc2.getnum());  

System.out.println(acc3.getnum());
//double d = Math.PI;
}

}
----------------------

이렇게 같은 패키지에 클래스 파일 두 개 만들어서 연동해서 쓰고 있는데 이 상태로 

맨 마지막 부분인 System.out.println(acc1.getnum());  
System.out.println(acc2.getnum());  

System.out.println(acc3.getnum()); 이거 출력하면 전부 답이 3 3 3 으로 나오는데

1 2 3 이렇게 순차적으로 나오도록 하는 방법 없을까 

추가적인 변수 추가는 안 하고 그냥 함수 안에서 바꿔서 출력해내고 싶은데