Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


neelam
Java switch statement
1 Answer(s)      3 years and 11 months ago
Posted in : Java Interview Questions


What restrictions are placed on the values of each case of a switch statement?

Advertisement
View Answers

October 23, 2010 at 12:18 PM


Hi,

Here is the answer.

When the program compiled, the values of each case of a switch statement must evaluate to avalue that can be promoted to an int value.

Thanks.



Related Tutorials/Questions & Answers:
Switch Statement with Strings in Java
Switch Statement with Strings in Java  Switch Statement with Strings in Java
Java switch statement
Java switch statement  What restrictions are placed on the values of each case of a switch statement
Advertisements
Switch Statement example in Java
more about the switch statement in Java. The following java program tells you... Switch Statement example in Java    ... for implementing the switch statement. Here, you will learn how to use the switch statement
switch statement
switch statement   i want to write a java program that computes Fibonacci,factorial,string reversal and ackerman using switch case to run as a single program
The Switch statement
. To avoid this we can use Switch statements in Java. The switch statement is used... of a variable or expression. The switch statement in Java is the best way to test.... Here is the general form of switch statement: switch (expression){ case 1
Java Switch Statement
Java Switch Statement       In java, switch is one of the control statement which turns the normal flow... more about the switch statement click on:   http:/www.roseindia.net/java
Switch Statement
Switch Statement  How we can use switch case in java program ?   Note:-Switch case provides built-in multiway decision statement.It... switch case statement. The program displays the name of the days according to user
Switch Statement in java 7
Switch Statement in java 7 This tutorial describes the if statement in java 7. This is one kind of decision making statement. Switch Statements : The switch statement is used when you want to test many statements based on some
Switch statement in PHP
Switch statement in PHP  HII, Explain about switch statement in PHP?   hello, Switch statement is executed line by line. PHP executes the statement only when the case statement matches the value of the switch
What is the difference between an if statement and a switch statement?
What is the difference between an if statement and a switch statement?   Hi, What is the difference between an if statement and a switch statement... values). Whereas the Switch statement offers you multiple choice of option from
Java - The switch construct in Java
Java - The switch construct in Java       Switch is the control statement in java which.... In this Program you will see that how to use the switch statement
Strings in Switch statement
Strings in Switch statement In this section, you will learn about strings in switch statements which is recently added feature in Java SE 7. Using JDK 7, you can pass string as expression in switch statement. The switch statement
Switch Case in Java
case will take place. Example of Switch Statement in Java: import java.io.... if-then and if-then-else statements. As switch statement allows in-numerous possible execution paths.... Switch statements with String cases are supported in Java SE 7 but the earlier
Switch case in java
Switch case in java In this section we will learn about switch case in java..., and java, switch case is used . switch  is a selection control mechanism used... if statementswitch allow the user to select a option from multiple options
How to use switch statement in jsp code
How to use switch statement in jsp code       switch is a type of control statement used... for in the switch statement are met or executed. Break Statement : The break
i need to replace this if statement code with switch case code
i need to replace this if statement code with switch case code   i need to replace this code with switch case for(int i=0;i<100;i++){ if((i...){ switch(i/j){ case 3: System.out.println ("java
switch Java Keyword
:  -- The switch statement in java language enables the user to select... switch Java Keyword       The switch is a keyword defined in the java programming language. Keywords
Find Capital using Switch-Case statement
Find Capital using Switch-Case statement In this Java Tutorial section, we are going to find the capital of our states using Switch-Case statement. For this, we have created two arrays i.e. array of states and array of capitals. Then we
switch functions - Java Beginners
switch functions  I am writing a script for use in a computer based... your month of hire:") switch(n) { case(n="January"): document.write("Last... friend, This is running code, switch option using in javaSctipt
C Break with Switch statement
C Break with Switch statement   ... the user to enter any number. The expression defined in the switch statement finds... If you enter the number 5, the switch statement checks the condition and shows
java if statement
java if statement  If statement in Java
Switch Case - Java Interview Questions
Switch Case  int x=100000; switch(x) { case 100000: printf("Lacks"); } output= Lacks I want reason why x matches switch case although range for int is in between something -32678 to +32676. Plz give me ans quickly
Switch
statements. To avoid this we can use Switch statements in Java. The switch statement... of a variable or expression. The switch statement in Java is the best way to test.... Here is the general form of switch statement: switch (expression){ case 1
using if and switch stmt - Java Beginners
be assumed. Write a program using "switch and if statement" to compute net amount...using if and switch stmt  A cloth showroom has announced...(); switch(menu) { case 1: System.out.print("Quantity: "); int q1 = scan.nextInt
Case Java Keyword
; The java keyword "case" is used to label each branch in the switch statement in java program. In other word Case is a java keyword... matches value that defined through a preceding switch keyword. In the java
save switch data into database - Java Beginners
save switch data into database  switch(menu) { case 1://add...(); switch(menu) { case 1: System.out.print("Enter student ID: "); int ID...:3306/register","root","root"); Statement st=con.createStatement(); int i
if else statement in java
if else statement in java  if else statement in java explain with example
JAVA statement - Java Beginners
JAVA statement  The import statement is always the first noncomment statement in a Java program file.Is it true?  Hi Friend, No,it is not true.If your class belongs to a package, the package statement should
if else statement in java
if else statement in java  explain about simple if else statement and complex if else statement in java with an example
Java callable statement
Java callable statement  What is callable statement? Tell me the way to get the callable statement
Write a java program to display the season given the month using switch case
Write a java program to display the season given the month using switch case  Write a java program to display the season given the month using switch case
 

 

 

DMCA.com