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

  • Home
  • SEARCH
  • 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 6891543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:25:25+00:00 2026-05-27T06:25:25+00:00

Possible Duplicate: Java isEmpty() undefined for String? I copied my code from one java

  • 0

Possible Duplicate:
Java isEmpty() undefined for String?

I copied my code from one java project to another and I get the error:

The method isEmpty() is undefined for the type String

But the same isEmpty() works perfectly fine for checking string in the original program.

Instead I can use str.length()==0. But wondering what would be the reason for this?

[edit] All of this are done in the same eclipse compiler version 1.7 in the same machine. i.e. Windows -> Preferences -> Java -> Compiler, I find the ” Compiler compliance level as 1.7″. Including the original program where isEmpty worked and the new program where it is not working.

My another project which has isEmpty works fine. I created a new proj and copied a part of code which has isEmpty and I am getting this error.

  • 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-27T06:25:25+00:00Added an answer on May 27, 2026 at 6:25 am

    isEmpty is a method from Java 1.6 and your problem is that you’ve got Eclipse’s Java compiler compliance level set < 1.6. The solution is to go into Eclipse’s preferences and set the compiler’s compliance level to 1.6 or higher.

    Menus:

    Windows -> Preferences -> Java -> Compiler.

    Edit
    SyncMaster states in a comment:

    … I find the ” Compiler compliance level as 1.7″.
    … I created a new proj and copied a part of code which has isEmpty and I am getting this error

    Solution: What I’ve described above is for the “master” compliance level, but each project can override this. To check the project’s compliance level, right-click the project in Eclipse’s package explorer, click Properties, then Java Compiler. Then you can decide whether or not to enable project-specific settings and just what those settings should be.

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

Sidebar

Related Questions

Possible Duplicate: java String concatenation How to Improve performance of this chunk of code
Possible Duplicate: Scala on Android: java.lang.NoSuchMethodError: java.lang.String.isEmpty I've just released a new app on
Possible Duplicate: Java - Convert String to enum I have a method that uses
Possible Duplicate: When do you use Java’s @Override annotation and why? From the javadoc
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: Java: convert List<String> to a join()d string Having this: List<String> elementNames =
Possible Duplicate: Java Generics To be more specific, whats the role of the <String>
Possible Duplicate: Java - why no return type based method overloading? The compiler does
Possible Duplicate: java PreparedStatement Can I make the prepared statement SELECT * FROM STUDENTS
Possible Duplicate: Java how to: Generic Array creation Error generic array creation I have

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.