| | |
From beginner in Java: Atomic type-what is it?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 18
Reputation:
Solved Threads: 0
Dear all
Could you tell me what is it-atomic type in Java? I explored internet and book Java in 21 days,but nothing about it. The question was about difference between object reference and atomic type. I found that object reference is an address that indicates where an object's variable and methods are stored.
Thank you
Could you tell me what is it-atomic type in Java? I explored internet and book Java in 21 days,but nothing about it. The question was about difference between object reference and atomic type. I found that object reference is an address that indicates where an object's variable and methods are stored.
Thank you
There is no atomic "type" in Java.
All of the classes in the java.util.concurrent.atomic package have the "Atomic" prefix in their names.
All of those classes "...provide atomic access to arrays of values and provide volatile access semantics for array elements, which is not possible with the volatile modifier itself." (Java in a Nutshell 5th Edition, pg. 855)
I hope that answers your question.
All of the classes in the java.util.concurrent.atomic package have the "Atomic" prefix in their names.
All of those classes "...provide atomic access to arrays of values and provide volatile access semantics for array elements, which is not possible with the volatile modifier itself." (Java in a Nutshell 5th Edition, pg. 855)
•
•
•
•
volatile
Roughly speaking, avolatilefield is like asynchronizedmethod: safe for concurrent use by two or more threads. More accurately,volatilesays that the value of a field must always be read from and flushed to main memory, and that it may not be cached by a thread (in a register or CPU cache).
Angel-headed hipsters burning for the ancient heavenly connection, to the starry dynamo in the machinery of the night.
-Ginsburg
Don't tell me to "google it" - I already have.
-Ginsburg
Don't tell me to "google it" - I already have.
An atomic type in the context referred to most likely should be read as a primitive type.
That's int, long, double, float, byte, and char.
They don't refer to Object references, like everything else.
That's int, long, double, float, byte, and char.
They don't refer to Object references, like everything else.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
And technically primitives are stored in a different memory space from object instances (but not the references you deal with to those instances).
But they can be stored in different memory spaces depending on where and how they're created, where object instances are always created in the same space.
But they can be stored in different memory spaces depending on where and how they're created, where object instances are always created in the same space.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- Beginner in Java: need a help (Java)
- Beginner using Java... Having trouble with javac and creation of .class files. (Java)
- full screen applet in java (Java)
- java.lang.NoSuchMethodError (Java)
- Element is undefined in a Java object of type class [Ljava.lang.String; referenced as (ColdFusion)
- need help to create a java program (Java)
- Credit card payments assignment (Java)
Other Threads in the Java Forum
- Previous Thread: Beginner in Java: need a help
- Next Thread: Query : Object creation error
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design draw eclipse encryption error event exception fractal game givemetehcodez graphics gui html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source oracle print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql static stop string swing testautomation threads time tree ui unicode validation windows






