File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes share state????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "share state?????" Watch "share state?????" New topic

share state?????

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
'Values of the primitive types do not share state'
what does this mean???
Sorry if it is a too stupid question!!! but, I'm not very good with english!!! here in my country isn't easy to find good forums!!!
marilyn murphy
Ranch Hand

Joined: Aug 28, 2001
Posts: 84
Primitive values do not share state with other primitive values.jls 4.2
Don't feel bad, it's not an easy statement for a native English speaker either.
marilyn murphy
Ranch Hand

Joined: Aug 28, 2001
Posts: 84
The state of an object typically contains
references to other objects.

However a primitive cannot contain anything but the primitive value of that type. It cannot contain references to another primitive.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
The idea is simple, and you may likely understand it already. An example that further illustrates the concept:
If a variable i of type int is declared and given it an initial value 0, and another int variable j is declared and assigned the value of i, then both variables would have the value 0. If i is later assigned a different value such as 1, the value of j is not affected - j would still be 0.Making sense?

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: share state?????
jQuery in Action, 3rd edition