0

I heard that the new version of Java String made ​​support in the operator Switch. Does it work now in Android?

user3158925
  • 41
  • 1
  • 7

1 Answers1

2

No. switch/case for String is only available for Java 7+, and Android Dalvik is based on Java 6.

EDIT: note that starting with API 16 there are some Java 7 features included, check this other answer.

Community
  • 1
  • 1
m0skit0
  • 25,268
  • 11
  • 79
  • 127
  • From the "other answer", it looks to me that some of those Java 7 features depend only on having a compiler that understands them, and is independent of what Android version is running on the device; and that `switch(String)` is one of those. Is my interpretation correct? – ajb Mar 27 '14 at 15:26
  • @ajb Might be, I really don't know, that's why I'm referring to the other answer. Personally I've always used Java 6. – m0skit0 Mar 27 '14 at 16:13