my dog learned polymorphism
The moose likes Mock Exam Errata and the fly likes String concentation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "String concentation" Watch "String concentation" New topic

String concentation

shabbir zakir
Ranch Hand

Joined: Nov 12, 2000
Posts: 183
public class x {

public static void main(String args[]) {
String s= "on"+'c';
if you compile this code it will give you an error at line no.3.Why cannot a char cannot be added to a string if other int types can be added.
mahesh jhamtani

Joined: Jan 12, 2001
Posts: 11
code is not giving me any error.???
madhuri vl
Ranch Hand

Joined: Jan 17, 2001
Posts: 86
I'm not getting any error and the output is onc.


Joined: Jan 21, 2001
Posts: 3
hai ,
It's compiling , no probs!!

I agree. Here's the link:
subject: String concentation
It's not a secret anymore!