This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "garbage collection" Watch "garbage collection" New topic
Author

garbage collection

Akhil Gupta
Greenhorn

Joined: Apr 22, 2001
Posts: 6
Are primitive datatypes also garbage collected or it is only objects, if no then do we free memory of primitives.
Bryan Timmins
Ranch Hand

Joined: Mar 26, 2001
Posts: 48
No, garbage collection is performed on objects. I think the JVM deals with primitives behind the scenes.


<a href="http://www.bryantimmins.com" target="_blank" rel="nofollow">Bryan Timmins</a> <br />SCJP2
Gurpreet Sachdeva
Ranch Hand

Joined: Feb 20, 2001
Posts: 90
Hello Akhil,
The JVM allocates the memory to primitives when the object of the class having those primitives is created and that memory is de-allocated when that object is garbage collected.
Regards
Gurpreet Sachdeva
For any type of information regarding JCP exam(including mock exams) visit at: http://www.go4java.20m.com

Regards<BR>Gurpreet Sachdeva<P>For Mock Exams, FAQ, Exam tips and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: <A HREF="http://www.go4java.lookscool.com" TARGET=_blank rel="nofollow">http://www.go4java.lookscool.com</A>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: garbage collection
 
Similar Threads
Tech Word Game
WA #1.....word association
Default Package
Locked Thread
What is the least sexy occupation?