Home In java, is there a way to combine String.contain() and String.equals() to print out a certain character when given another?
 I was working on some java code that prints out "secret code" when you input a certain phrase. ("Hello" would print "itssg", a=q, b=w, c=e, etc) I got through part of it only to realize I can't use String.contain() or String.equals() if I want the corresponding letters printed out. Is there someway to combine the two to make the letters match up to the secret code? Here's part of the code: String r = JOptionPane.showInputDialog(null, "Enter the text you want to be turned into secret code.\n\n The secret code will print out at the bottom of your screen."); if ("A".equals(r) || "a".equals(r)) { System.out.print("q"); } else {} if ("B".equals(r) || "b".equals(r)) { System.out.print("w"); } else {} if ("C".equals(r) || "c".equals(r)) { System.out.print("e"); } else {} if ("D".equals(r) || "d".equals(r)) { System.out.print("r"); } if ("E".equals(r) || "e".equals(r)) { System.out.print("t"); } if ("F".equals(r) || "f".equals(r)) { System.out.print("y"); } if ("G".equals(r) || "g".equals(r)) { System.out.print("u"); } if ("H".equals(r) || "h".equals(r)) { System.out.print("i"); } if ("I".equals(r) || "i".equals(r)) { System.out.print("o"); } if ("J".equals(r) || "j".equals(r)) { System.out.print("p"); }