Can we use string in the switch case?
Answer / Mohammad Hasan Siddiqui
Yes, Java allows using strings in the switch case. However, instead of equals(), it compares the string values using '==' or .equals() method.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are operators and its types?
Why do inner class cannot have static declaration except static nested class?
What is the statements?
What is difference between throw and throws ?
Can inner class be public in java?
Explain wait(), notify() and notifyall() methods of object class ?
How to send a request to garbage collector?
Is string a datatype?
What is jit compiler ?
Which characters are allowed to use as the second character of an identifier, and which characters are not allowed?
What about interrupt() method of thread class ?
What is operator overloading. Is it is supported in java?