wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes primitve assignments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "primitve assignments" Watch "primitve assignments" New topic

primitve assignments

Smitha Ballikar
Ranch Hand

Joined: Aug 02, 2005
Posts: 99

A Enter

Joined: Aug 16, 2005
Posts: 20
The c is a char,The s is a String,The result is a String when the c + s or s + c
Pulamathi Pavan Kumar

Joined: May 31, 2005
Posts: 6
In Java only operator overloaded is " + ".

U cannot append character with a string since + is used only with Strings.
in the second line s+=c,

Everything that gets appended to String will be converted to String.So it works in the second case.
For ur clarification,

int i=2,j=4;
String str="abc";

Outputs will be:
(1) abc 2 4-----> If anything appended after a string, entire is a string.
(2) 6 abc

Hope this shuld help...

I agree. Here's the link: http://aspose.com/file-tools
subject: primitve assignments
It's not a secret anymore!