• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Am getting incompatible types at toLowerCase() is it because of jdk 6 version?

 
kavitha vakiti
Greenhorn
Posts: 10
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Islam Amin
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I think you need to update your jdk since I tried the code and it worked. I am using jdk 8.
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, String in switch case was not available in Java 6, it was added in Java 7.
So it is high time to upgrade and to current version.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that this has nothing to do with toLowerCase(), but with the switch.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kavitha vakiti wrote:Am getting incompatible types at toLowerCase() is it because of jdk 6 version?

Definitely! The toLowerCase() returns a String which is used in a switch statement.

In Java 6 you can NOT use Strings in a switch statement. Strings in switch statements is a new language feature of Java 7.

Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic