560 pts.
 STATIC keyword of Java in AS400
When we say a variable is STATIC in a Java program in the AS400, does it mean that every user session that access the class access the same variable (storage location in memory)?

Software/Hardware used:
V5E4
ASKED: August 15, 2010  4:16 PM
UPDATED: August 26, 2010  4:43 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Sorry, the hardware used is AS400 V5R4.

 560 pts.

 

You have asked a surprisingly tricky question. I’m looking into a way to be certain. Since the most common use is as a constant value, it usually doesn’t make much difference.

But you have a specific side-effect in mind that is generally implementation-dependent. If I can prove one way or the other for V5R4, I’ll see about V6R1, too.

This might take a day or two if I can get a proper setup going.

Tom

 108,025 pts.

 

Tom
Constants would be a final static.
Phil

 44,150 pts.

 

Hi Tom and Philip,

If it were not in the AS400, the answer would be yes because that’s what I read in Java books. But when in the IBM i, I am just not sure.

In RPGLE, the static keyword (at least for V5R4) would mean, all programs running in the same job would be accessing the same memory location.

But Java in IBM i? Well…

Also, I am not planning on using it for constants. I can use that to see how many users are accessing a certain application. This is a side project I am doing nn my own time for the company I work for. I am studying Java to augment my skills as a programmer and what better way than to create some utility which I think would be useful to the company.

I’m beginning to think Java in the IBM i side has limited potential… Those who disagree, please enlighten me.

Thanks!

 560 pts.