Hey all. I've been messing around with JAVA for a few days and I have this small script I that I cannot get to compile. Any help is much appreciated. //UpperToLower import javax.swing.JOptionPane; public class UpperToLowerDalziel { public static void main(String[] args) { char chUpper, chLower; while (true) { String dataString = JOptionPane.showInputDialog(null, "Enter Uppercase Character: Enter # to Quit", JOptionPane.QUESTION_MESSAGE); chUpper = dataString.charAt(0); // Get the first character in string chLower = upperCaseToLowerCase(chUpper); String output = "Uppercase " + chUpper + " is " + " Lowercase " + chLower; JOptionPane.showMessageDialog(null, output, "Upper To Lower", JOptionPane.INFORMATION_MESSAGE); if (chLower == '#') break; } } public static char upperCaseToLowerCase(char ch) { int offset = 32; if (ch >= 'A' && ch <= 'z'); return (char)(ch + offset); return ch; <----ERROR } } // End of script Code (markup):
This forum is related to javascript, not java. Anyway, can you post the error message you're getting ? Also you should replace if (ch >= 'A' && ch <= 'z'); with if (ch >= 'A' && ch <= 'Z'); ('Z' should be uppercase, not lowercase).