Take a look at the braces after your
switch
statement:
switch(choice.toUpperCase().charAt(0))
{
case 'p' :
for(int i=0; i<count;i++){
System.out.printf("%.2f",Array2[i]);
}
}
break;
case 'D' :
Clearly,
case D
is outside the code block following the
switch
statement, so is "orphaned". This might have been obvious to you if you were to indent your code consistently. Even with the odd indentation shown above, it should be clear that
case 'D':
etc were outside the scope of the
switch
block.
If you're calling
toUpperCase()
on choice, then clearly
case 'p'
won't ever get selected, so that looks like its a bug, to me.
In future, when asking a question, please actually
ask a question. Don't just blindly dump source code and hope someone can figure out from the question title what's going on. In this case something like
I am getting the following error message from the java compiler :
some err message with line number. I'm not sure what that means. Can someone please explain it to me?