Console output written twice, static variables changed twice

Hi there!
Has anyone come across this?
When I have a simple debugging output, it is always written twice, e.g. I got a method doing something and want to know, how often it is being called. I have a class variable counter (initialized with 0), and at the very beginning of the method I write
counter++;
System.out.println("nr. of calls: " + counter);
It gives me the correct number, but twice, e.g.:
nr. of calls: 5
nr. of calls: 5

Now this wouldn’t be too bad, but when I declare the variable static, the following is printed:
nr. of calls: 5
nr. of calls: 6
And worse, it isn’t just printed, the variable really HAS been incremented twice then!
Anybody got an idea???

Greetings

when it’s static, it’s no longer a member of the instance, but a member of the class.

If you call this on two instances, the same variable will be incremented.

You might want to post your sourcecode, as without that, it’s hard to help.

Hmm, since I can’t post the whole sourcecode here (simply too much, many classes) I tried to
reproduce this in a simple test case but I don’t get it. However, there’s…
OH MY GOD!!!
In the middle of the sentence I rethought your post which brought up a certain suspect.
I mean, I thought “Man, there is only ONE instance!”, but hell, you’re completely right!!!
I had created two instances of the class elsewhere! Now that there’s only one left, everything
works as it should - thank you so much :)!!!

Regards, Morte