DtheK
Apprentice

- Joined
- Oct 17, 2009
- Sythe Gold
- 0
- Messages
- 873
Code:
String s = JOptionPane.showInputDialog("Enter the Input:");
String c = "";
int n = s.length();
String a = s.substring(0,2);
String b = s.substring(2,n);
if(a=="HE")
c="E";
System.out.println(c+b);
I want the code above to print out ELLO when I input HELLO. It compiles, but when I run it, it just prints out LLO. I tried printing out the string c too, but it doesn't display anything...I know the error must be somewhere here:
Code:
if(a=="HE")
c="E";
Sorry if I am asking a dumb question, but I am pretty new to working with this kind of stuff


