• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java addition with char  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, in my assignment i needed to use charAt to separate the string into 14 parts. Now i need to use addition and add these together.

I have tried many times with no success, every time I add them together and print it out it gives me a number way bigger than it should be.
     


How can i do this?
 
Sheriff
Posts: 11747
191
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael, you need to remember that we can't read what you don't post.  There has to be more details to this. I can probably guess what details you've left out but I'd rather you learn how to write complete posts that don't leave much to other people's imagination so that they can give you precise advice that's based on known information, not guesses.

What kind of characters is this String comprise of? Are they just digits? No non-digit characters? Are you trying to get the sum of all the digits in a number?
 
lowercase baba
Bartender
Posts: 12613
50
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also...what are you expecting to see, and what are you actually seeing?
 
Marshal
Posts: 58424
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to refine the last question: did you expect '1' to map to the number 1?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!