I am new to Java and can not figure out why I am getting this error for swithc case.

Member Avatar for iamthwee

1) Please post your code here.
2) Make sure you indent your code properly
3) Use [code]

[/code] tags
4) Post what error messages you get.

Not sure what problem you are facing... but one obvious thing i spotted is that you are having a statement after the break; You might have got 'Unreachable code' error. If that's not your issue, could you elaborate on your problem? Also, could you please correct indentation?

You have two curly bracklets on start of switch statement and only one on closing

switch (sCode){
{           
           case 'c':
           case 'C':

so delete one.
However once this done there is another 13 error messages which you need to sort. GL

I am new to Java and can not figure out why I am getting this error for swithc case.

I did correct the errors but I can not get the input message for Fahrenheit to show ConvertTemp05 in the heading box. and the 'c' to show. It only shows c. I have attached the correct code

Thanks a bunch

The code you have given have following problems:
1. There is no java object type called "character". Might be you wanted "Character".
2. You have not defined what is "input" variable on line 28.
3. You have not defined "temp", "cel", "df" before you used them. You can not initiate them whenever you want. (Happened for "df")
4. This whole line has formatting error:

JOptionPane.showMessageDialog(null, (cel + " degrees in Celsius is " + df.format (f) + " degrees in Fahrenheit." "ConvertTemp05");

5. What is "fht"?????????????
Please fix these problems first, the program should work. (I am wondering how did you get any kind of output.. the code should not compile even)... Good luck.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.