Originally posted by srilatha annepu:
am i right
System.out.println(Integer.toBinaryString(4));
given answer:4
mine is:100(as it converts to binary formatt)
Originally posted by chaitra mathur:
As i read an article i understood that strings from the string literal pool cannot be garbage collected.
Originally posted by Bert Bates:
Just for all of you out there keeping score, remember that although some mock exams might mix the concept of the String pool in with the concept of garbage collection, the real 1.4 and 5.0 exams WILL NOT mix those two together in a question. If the real exam wants to ask about how many objects might be eligible for the GC it will use objects of a type other than String objects.
Originally posted by Vijay Raj:
Why should it be 2.
Originally posted by Sriram Sharma:
I feel its 2.
Because, String "abc" is an object.
This object is created locally and hence eligible for garbage collection.
So, totally there are 2 objects for garbage collection.
What I dont understand is...Aren't the string objects in string pool good enough for garbage colection, if the relevant string objects are not in the scope?
Correct me if I am wrong.
Originally posted by Paul Anil:
Hi Morten,
It was just a generic message not directed at youWe have fixed the error you mentioned. Thanks a lot for the feedback.
-Paul.
Originally posted by Keith Lynn:
This is from the Java Language Specification.
A new class instance is implicitly created when the string concatenation operator + (�15.18.1) is used in a non-constant (�15.28) expression, resulting in a new object of type String (�4.3.3).