Computer Applications
Write the syntax of switch statement.
Java Conditional Stmts
5 Likes
Answer
The syntax of switch statement is as follows:
switch (expression)
{
case value1:
statements;
break;
case value2:
statements;
break;
...
...
case valueN:
statements;
break;
default:
statements;
}
Answered By
4 Likes
Related Questions
Find out the error(s) in the following code and underlining correct error(s).
int m = 5; n = 10; while(n >= 1) { System.out.print("m"); n--; }Evaluate the following expressions, when int a = 8, b = 14.
(a) b/a++
(b) --a + b-- + a
What will be the output of the following program segment?
int a = 100; while(false) { if(a < 50) break; a = a - 10; } System.out.println(a);Define a class with the following specifications
Class name : employee
Member variables
eno : employee number
ename : name of the employee
age : age of the employee
basic : basic salary (Declare the variables using appropriate data types)Member methods
void accept( ) : accept the details using scanner class
void calculate( ) : to calculate the net salary as per the given specificationsnet = basic + hra + da - pf
hra = 18.5% of basic
da = 17.45% of basic
pf = 8.10% of basicif the age of the employee is above 50 he/she gets an additional allowance of ₹5000
void print( ) : to print the details as per the following format
eno ename age basic net
void main( ) : to create an object of the class and invoke the methods