Orphaned Case Error in Java is one of the rarest errors you can see in Java. You can see this error in cases like
- When you write your case statements outside your switch statement.
switch (var) {
case 1:
//some code here....
break;
}
case 2:
//some code here....
break;
- If by mistake if you terminated your switch testaments unexpectedly
switch (var); { <--- statement terminated by ;
case 1:
//some code here....
break;
}
Note : Errors like this won't be seen if you are using an IDE since they compile your code on the fly and show the error message immediately, only traditional compilers will show this error, when you compile through your command line.