I can't believe i've gotten this far. My problem is my output. This program is suppose to take input from the user and increment each letter by 2. So after taking the String from the user I turn there message into a char array. then while outputing it I added 2 to each letter. and my ouput is acssii numbers. I need it to be the actual letter. how do I do this?
import java.util.*;
public class Encryption {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String userMessage = " ";
Scanner input = new Scanner (System.in);
System.out.print ("Please enter your Message:");
userMessage = input.nextLine().toUpperCase();
char arr[] = userMessage.toCharArray();
for (int i=0; i< arr.length;i++){
System.out.print(arr[i] + 2);
}
}
}
Example input : "Thank you" Example output : 867467807734918187
Please explain to me why this is happening.