I am having a problem with my java code, basically I want to do this;
char letter = 'a';
char convertedletter = letter + 5;
System.out.print(convertedletter);
the output should be f, but the output I get is 108. How could I make it an f?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try this:
The operator “+” is used to add numbers or concatenate String, since you are using it whit a char (only one character) and a int it would return a int unless you converted it to char with is what you want.