MarcusFenix wrote:
All the time, I was thinking about that "staticly instatiate" means -
instatiate the object without using a "new" operator. And I was wrong :///
could U tell me what`s "static instatiate"? I`m search in google, but i
don`t find answer... This`s connotated with getInstanceOf method? Please,
give me an example.

Regards,
C.
Java does not do static instantiation of objects like C++ / C# [?]. Java does support static instantiation of primitives (obviously).

Perhaps you were confused when Paul said "First I'd say ditch the static references..." What he meant here was, you had a static member (private static int currentAmount = 0;) and two static methods (public static void setCurrentAmount(int _currentAmount) and public static int getCurrentAmount()). This is clearly not what you want. A static member is shared by all instances of the class. A static method cannot manipulate instance variables. Now, seeing what you did with your recent code, you did correctly remove "static" from the member variable and methods. As Dave Newton pointed out, the error given by the container is almost definitely because you are trying to call a method on a variable that is not instantiated. Either in the constructor of Settings, or in the declaration of the ac1,ac2,ac3 member variables, you need st like:
ac1=new Account();
ac2=new Account();
...

before you call ac1.setCurrentAmount. I would suggest that you take a look at some of the Java primers / intro OO courses available.

PK

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to