| Author |
Regarding Strings
|
prarthana reddy
Ranch Hand
Joined: Jul 24, 2006
Posts: 48
|
|
Hi, Please have a look at the following question: How many String objects are created when we run the following code. String s1,s2,s3,s4; s1 = "Hello"; s2 = s1; s3 = s2 + "Pal"; s4 = s3; can anyone please give me the answer ?
|
 |
Naina Si
Ranch Hand
Joined: Nov 05, 2003
Posts: 134
|
|
|
two objects
|
 |
Naseem Khan
Ranch Hand
Joined: Apr 25, 2005
Posts: 809
|
|
Three objects created here. "Hello" and "Pal" is created at class load time as they are compile time constants, "HelloPal" at the time of the execution of the class. Naseem
|
Asking Smart Questions FAQ - How To Put Your Code In Code Tags
|
 |
cathymala louis
Ranch Hand
Joined: Nov 02, 2005
Posts: 77
|
|
Three objects created. 1. Hello 2. pal 3. Hello pal
|
 |
 |
|
|
subject: Regarding Strings
|
|
|