• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code compiles in cmd prompt but not in Editor.

 
Prabal Nandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Please check the code snippet below:


This Code compiles in cmd prompt  but does not compile in Editor.
Showing error at line 4: incompatible types firstName. A type reference is not allowed.

Please suggest!

Thanks.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3820
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your IDE is probably using JDK 6 to compile.

 
Ganesh Patekar
Bartender
Posts: 696
23
Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Oracle Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since Java SE 7 and later, you can use a String object in the switch statement's expression. Your IDE might be using older version than Java 7 so change It to 7 Or later.
 
Prabal Nandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul and Ganesh.
The editor was was using JDK 6.
 
Prabal Nandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prabal Nandy wrote:Thanks Paul and Ganesh.
The editor was using JDK 6.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic