Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String concentation

 
shabbir zakir
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class x {

public static void main(String args[]) {
String s= "on"+'c';
System.out.println(s);
}
}
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
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code is not giving me any error.???
 
madhuri vl
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I'm not getting any error and the output is onc.
 
k_arulvel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai ,
It's compiling , no probs!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic