| Author |
how many objects are created by this statement
|
Saravanakumar Rajmohan
Greenhorn
Joined: Jul 08, 2003
Posts: 17
|
|
how many objects are created by this statement? System.out.println( "Hi everyone" + 3 ); String object representing "Hi everyone" Wrapper object for representing the primtive value 3(is this required ?) String object representing the value 3 String object representing "Hi everyone3" is this correct or will this undergo optimisation(will it involve StringBuffer)? . will this have a constant behavior in all JVM implementations can somebody explain this thank u Saravanakumar R
|
 |
Calvin Yan
Greenhorn
Joined: Jun 25, 2003
Posts: 19
|
|
Hi I think the created objects should include "Hi everyone" and "Hi everyone3"
|
I will do the best with what God gave me!
|
 |
Ted Smith
Greenhorn
Joined: Jul 20, 2003
Posts: 3
|
|
In this scenario, Two objects was created, 1. "Hi everyone" 2. "Hi everyone3" Wrapper object is not needed in this case. The concatenation method of String class can accept an integer primitive.
|
 |
sherry cuenco
Greenhorn
Joined: May 07, 2003
Posts: 24
|
|
I think there are three objects created. 1 "Hi everyone" 2 "3" // Java converts int 3 to a String 3 "Hi everyone3"
|
 |
 |
|
|
subject: how many objects are created by this statement
|
|
|