This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi. This is the code I got from a book explaining Garbage Collection.Cannot understand any part of the progam.Would be grateful if someone explain the stepwise execution of the program. Also I did not understand
HeavyItem list=createList("X"); list = createList("Y");
and the code written in the main method.
What exactly do you mean by these lines.
The future belongs to those who believe in the beauty of their dreams.Dream BIG!
Originally posted by Nabila Mohammad: ...Also I did not understand
HeavyItem list = createList("X"); list = createList("Y"); itemA = new HeavyItem(itemID, null);...
It would be difficult to grasp garbage collection without understanding object creation, because garbage collection is all about "unreachable" objects that can be cleared from memory.
new HeavyItem(itemID, null) creates a new instance of HeavyItem by calling a HeavyItem constructor that takes arguments of a String and a HeavyItem. In this case, the String is referenced by itemID, and the HeavyItem is a null reference.
createList is a method that takes a String argument and returns a reference to a HeavyItem. In fact, the method creates three new instances of HeavyItem and returns a reference to one of these. But this HeavyItem HAS-A HeavyItem, which in turn HAS-Another HeavyItem.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Nov 05, 2007
Hey. Can you tell me where I can get the details of Object creation besides the regular stuff. ie. MyClass obj=new MyClass();
Hi Nabila If you are preparing for Java Certification, then this book is for you, although others are recommended for SCJP, see JavaRanch FAQ.
However a Certification guide is not intended for teaching language basics instead teaches exam stuff.. If you aren't interested in SCJP then better find an introdutory book which focuses on learning the language.
Joined: Nov 05, 2007
Can you suggest some link where i can brush my basics?