-1

Is swich can take string parameter yes or no like

string s="Mo";
swich(s)
{
case "sa ":
break ;
case "jv":
break;
default :
break:
}
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by gangsta1903
0

no.

this is what java.sun.com says:

A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer.

If you use static strings in your switch, then you may think to enumerate them.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.