Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can you please sort the error??

 
Deepakk Verma
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having error in the program can anybody help please


Error is in 7th line as:
Type mismatch: cannot convert from char to String
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the error indicates, String#charAt returns a char, which you are trying to put in an array, designed for Strings
You need to convert the char to a String. Check out the String API for a convenient method.

PS. Also check out String#substring()
 
Deepakk Verma
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OOPS.....i should have taken care of that ............Thanks Maneesh
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic