How to change letters to other letters Java [closed]

First you would need to create a Map of all the letters:

Hashmap<String, String> map = new Hashmap<String, String>();
map.put("a", "c");
map.put("b", "f");

To get the translation of each letter you simply get the value from the map:

String translatedLetter = map.get(letter);

So now you would need to create a loop to translate the whole word one letter at a time. I would use a StringBuilder to keep track of each translated letter.

Browse More Popular Posts

Leave a Comment