Tuesday, 27 August 2013

using or operator on String in java

using or operator on String in java

I want to check a string with a multiple values using or operator , is
that possible ?
like if(str.equals("A" || "B" || "C")){
//do this
}
else if(str.equals("D" || "E" || "F")){
//do that
}
I am getting error while compiling, that || can not be used in string

No comments:

Post a Comment