Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
class Example {
static void main(String[] args) {
//initializing a local variable
int a = 2
//Evaluating the expression value
switch(a) {
//There is case statement defined for 4 cases
// Each case statement section has a break condition to exit the loop
case 1:
println("The value of a is One");
break;
case 2:
println("The value of a is Two");
break;
case 3:
println("The value of a is Three");
break;
case 4:
println("The value of a is Four");
break;
default:
println("The value is unknown");
break;
}
}
}
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more