Q:

Having trouble changing characters in strings

So the question asked is: To change the characters of a string with 3 characters ahead of them so lets say the string is "AB cd" it would be changed to: "DE fg". I am not good at programing but I have tried my best and come up with this:
import java.util.*;

public class encrypt{

    public static void main(String[] args){

        Scanner reader = new Scanner(System.in);
        System.out.println("Enter a message to encrypt: ");
        String message = reader.nextLine();

        List<Character> Lowercase = Arrays.asList('a','b','c','d','e','f','g','h','i','j',
  'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');

        List<Character> Uppercase = Arrays.asList('A','B','C','D','E','F','G','H','I','J',
  'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');

        for ( int i = 0; i < message.length(); i++ ) {  
            char c = message.charAt( i );

            if( c == ' '){
                continue;
            }
            else if (c != ' '){
                for ( int i = 0; i < Lowercase.size(); i++ ) {
                    char b = Lowercase.indexOf(i);

                    if(c == b){
                        message.charAt(i)=Lowercase.indexOf(i+3);
                    }
                }
            }

            for ( int i = 0; i < Uppercase.size(); i++ ) {
                char j = Uppercase.indexOf(i);

                if(c == j){
                    message.charAt(i)=Uppercase.indexOf(i+3);
                }
            }
        }
    }               
}

I have been getting errors like :
Problem1.java:20: error: variable i is already defined in method main(String[])
            for ( int i = 0; i < Lowercase.size(); i++ ) {
                      ^
Problem1.java:21: error: possible loss of precision
               char b = Lowercase.indexOf(i);
                                         ^
  required: char
  found:    int
Problem1.java:23: error: unexpected type
                  message.charAt(i)=Lowercase.indexOf(i+3);
                                ^
  required: variable
  found:    value
Problem1.java:27: error: variable i is already defined in method main(String[])
any help would be appreciated :) thanks.

A:

I believe there is a easier way to solve your issue, and you can find your answer in ASCII table

As you see, words have some number related to them like capital A is 65 and small c is 99, as a result, you can go through the number and use casting processes to get char you want.
read more casting from string to int
I think you should try this 
Code:
        String s = "eh az";
        for (int i = 0; i < s.length(); i++) {
            int a = s.charAt(i);
            if (a >= 97 && a <= 119) {
                System.out.print((char) (s.charAt(i) + 3));
            } else if (a >= 120 && a <= 122) {
                a -= 23;
                System.out.print((char) a);
            } else if (a == 32) {
                System.out.print(" ");
            }
        }

output:
hk dc

