Switching cases with string Java

After using java for a long time, I found that, unlike other languages, Java does not support switch cases with strings (only no and enums) What is the reason behind it? If other languages are easy to implement, why not Java?

Solution

This function is implemented in Java 7 (released in July this year) Why didn't they implement it earlier? Because Oracle acquired the whole sun, J7 was indeed delayed

Latest documents: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>