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

S

som

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
 
T

Thomas Kellerer

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/JDCTechTips/2002/tt0305.html
 
S

som

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top