public class Switch {
public static void main(
String[] args) {
final int a = 1;
final int b;
b = 2;
int x = 0;
switch (x) {
case a: // ok
case b: // compiler error
}// end of switch statement
}// end of main method
}// end of class
Hi friends,
in the above problem, I am giving values to the final variables in main method. so, they won't get any default values.
why am i getting error for case b?
Thanks in Advance
srini