i have following two doubts from K & B book: 1. final int a = 1; final int b; b = 2; int x = 0; switch (x) { case a: // ok case b: // why this is compiler error
2. byte g = 2; switch(g) { case 23: case 128: } in the preceding code byte is cast to an int then why 128 is large as case constant?
Originally posted by Abhishek Mantri: i have following two doubts from K & B book: case 128: in the preceding code byte is cast to an int then why 128 is large as case constant?
can you compile this:
byte b = 128;
SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog