Wouter Oet wrote:Eh Math.pow() maybe.
Sandra Bachan wrote:Actually, I am unable to grasp your code.
Are we supposed to pass arguments to the execution of the program, i.e.
java b arg1 arg2 arg3
How is this program supposed to work. I am perplexed![]()
Sahil Rally wrote:I am concerned about "What you wrote in last" . Whether second time "abc" would go into pool as abandoned object or not !!!
![]()
Peter Taucher wrote:Doesn't the hashCode method of String base on it's content? And I think StringBuilder doesn't provide an implementation of hashCode, so it uses Object's method. Therefore the result should be 'false true'.
Sahil Rally wrote:Reference :- SCJP 6 k&b pg 434
It is written that,
String s= "abc" ;//Line 1 //creates one strig object .
In this simple case , "abc" will go in the pool and s will refer to it.
String s = new String("abc"); //Line 2 // creates two string objects
One object in non-pool memory
Another one in Pool memory
I have following two questions
Q1:- Why an object is also placed in a pool memory.
Q2:- As said by k&b that line 2 would create 2 objects in which one of them will go into pool, but after line 1 we have "abc" already in the pool, then why one more. Or the two statements are independent of one another.
Emanuele Ghe wrote:Hi,
the best thing for you is to try the program yourself in spite of making this kind of posts.
You will learn a lot more trying things in spite of asking.
You should ask only when, even trying, you can't understand something, or you need some kind of clarification.