943,793 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4619
  • Java RSS
Aug 4th, 2007
0

From beginner in Java: Atomic type-what is it?

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ainur is offline Offline
18 posts
since Aug 2007
Aug 4th, 2007
1

Re: From beginner in Java: Atomic type-what is it?

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)

Quote ...
volatile
Roughly speaking, a volatile field is like a synchronized method: safe for concurrent use by two or more threads. More accurately, volatile says 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).
I hope that answers your question.
Reputation Points: 23
Solved Threads: 2
Junior Poster in Training
indienick is offline Offline
71 posts
since Aug 2005
Aug 4th, 2007
0

Re: From beginner in Java: Atomic type-what is it?

Thank you!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ainur is offline Offline
18 posts
since Aug 2007
Aug 4th, 2007
0

Re: From beginner in Java: Atomic type-what is it?

You are very welcome!
Reputation Points: 23
Solved Threads: 2
Junior Poster in Training
indienick is offline Offline
71 posts
since Aug 2005
Aug 5th, 2007
0

Re: From beginner in Java: Atomic type-what is it?

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Aug 5th, 2007
0

Re: From beginner in Java: Atomic type-what is it?

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Beginner in Java: need a help
Next Thread in Java Forum Timeline: Query : Object creation error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC