0

Is there any need to Override equals() method to used String datatype in Switch case

3
  • 3
    aahhhh....... no. It will work just fine as is. Commented Mar 13, 2013 at 9:04
  • no................... Commented Mar 13, 2013 at 9:04
  • 4
    You can't even override any methods in String. String is final. Commented Mar 13, 2013 at 9:05

2 Answers 2

3

Not only you don't need to do this, you simply can't (String is final).

Sign up to request clarification or add additional context in comments.

Comments

1

If your intention is to use String in your Switch statement then it's better to use ENUM TYPE

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.