Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Doubt!!!!!!!!!!!!!!!!

Reply
Thread Tools

Doubt!!!!!!!!!!!!!!!!

 
 
som
Guest
Posts: n/a
 
      12-29-2006
Hi,

I am new to this group and learning Java, i have a doubt can any one
answere to this Q!

When we use the binary string concatenation operator (+), how many
String
Objects will be
created?

String zero = "zero";
char one = "1";
Float ten = 10.1;

String first = zero + "second" + 2 + "third" + 3 + one + ten;

At run time, when the above line of code is executed, how many objects
will
be created?

Regards
Soumya

 
Reply With Quote
 
 
 
 
Thomas Kellerer
Guest
Posts: n/a
 
      12-29-2006


On 29.12.2006 09:52 som wrote:
> Hi,
>
> I am new to this group and learning Java, i have a doubt can any one
> answere to this Q!
>
> When we use the binary string concatenation operator (+), how many
> String
> Objects will be
> created?
>
> String zero = "zero";
> char one = "1";
> Float ten = 10.1;
>
> String first = zero + "second" + 2 + "third" + 3 + one + ten;
>
> At run time, when the above line of code is executed, how many objects
> will
> be created?


You should also learn to use search engines in the internet. One of the
first hits when searching for "java string concatenation" is:

http://java.sun.com/developer/JDCTec...02/tt0305.html
 
Reply With Quote
 
 
 
 
som
Guest
Posts: n/a
 
      12-29-2006
Thanks its really good, In shrt i wanted to know the imporatnce of +
operator in Java, now i am clear, it is used to concatenate strings and
in integer it acts as an additional operator!

Soumya. G

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments