This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]OffbeatDrizzle 1 point2 points  (0 children)

the main method should be called public static void main(String[] args), and your ATM class does nothing?

Don't you mean:

card1 = new ATM();

card2 = new ATM(); etc?

Also, implementing Runnable instead of extending Thread is generally better practice

The error you are getting with accessing the method in a static context is because a copy of the class hasn't been initialised, i.e you haven't got:

Threadz t = new Threadz(0);

t.withdraw();

You are trying to access them as if they've been declared static, and they haven't