I do the following code
int cnt=1;
switch(cnt){
case (cnt<=10): System.out.println("Less than 10");
break;
case (cnt<=20): System.out.println("Less than 20");
break;
case (cnt<=30): System.out.println("Less than 30");
break;
}
There are some questions available about this problem. But i didn't got proper answer or the answer is not fulfill my needs. I got the answers to this problem is use multiple if else statements. But I want to know why operators not work in java switch case?