Tester Developer
Tester Developer

Reputation: 1

Java 7 New Feature String datatype in Switch case

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

Upvotes: 0

Views: 204

Answers (2)

Sam R.
Sam R.

Reputation: 16450

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

Upvotes: 1

NPE
NPE

Reputation: 500743

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

Upvotes: 3

Related Questions