How to use switch statement in java
Hi, friends I am new to Java Programming as I am beginner I have seen the best uses for this java programming and also it is simple and strong OOP. So I am very much excited to know more about this language. The first thing that I want to know from you guys is about the uses and implementation of switch statement in java, so if you have any suggestion or any ideas about the uses of switch statement and program for switch statement then please let me know.
Re: How to use switch statement in java
According to my information this statement is used for selecting the case for the execution of statements. This switch statement also works same as if-then and if-then-else statements these switch statement have numbers of possible execution paths. The switch works with the following primitive data Type byte, short, char, and int.
Re: How to use switch statement in java
The following is the syntax of switch statement
Quote:
int d=3;
switch(d)
{
case 1:
//do this statement 1;
break;
case 2:
//do this statement 2;
break;
case 3:
//do this statement 3;
break;
default:
//do this default statement;
}