Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5976351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:12:57+00:00 2026-05-22T21:12:57+00:00

According to The Java Tutorials , in Java SE 7 and later, you can

  • 0

According to The Java Tutorials, in Java SE 7 and later, you can use a String object in the switch statement’s expression.

String s = ...
switch(s){
    //do stuff
}

But is this true? I’ve installed the JRE and added it to the build path of my Eclipse project, but I’m getting the following compile-time error:

Cannot switch on a value of type
String. Only convertible int values or
enum constants are permitted

Also, I think I’ve got it configured correctly since I was able to use its java.nio.file.Files class, as well as JLayer.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:12:57+00:00Added an answer on May 22, 2026 at 9:12 pm

    While it is true that the JDT team has implemented the Switch on String feature, the support for Java 7 won’t be before Eclipse 3.7.1:

    See bug 288548:

    Due to late availability of JSR-292 (Invoke Dynamic) and JSR-334 (Project Coin)
    and due to the official release date (July 28, 2011) of Java 7 being after 3.7
    ships we had to defer the Java 7 support to 3.7.1. It has not yet been decided
    whether this will be available as part of the 3.7.1 downloads or as separate
    feature update.

    The work for the Java 7 features is currently in progress in the ‘BETA_JAVA7’
    branch and we will deliver separate updates for the stable builds in order to
    provide early access to the Java 7 features for interested parties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java we use System.setProperty() method to set some system properties. According to this
According to JAVA documentation , Connection#commit() can throw SQLException . My question is whether
According to Brian Goetz's Java Concurrency in Practice JVM can't exit until all the
In Java, am I able to extend from a generic supertype? According to this
I want to use maven integrated with eclipse to develop webapp according this tutorial:
According to java when setDaemon is set to true it does not prevent the
According to Java thread state info calling wait() will result a thread to go
According to the Java Language Specification : If there are any enclosing try statements
According to the Java Language Sepecification , 3rd edition: It is a compile-time error
According to the documentation of java.util.Pattern , the POSIX character class \p{Graph} ( [:graph:]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.