Java isEmpty()未定义为String? [英] Java isEmpty() undefined for String?
问题描述
我正在eclipse中的一个学校项目上工作,当我尝试使用 isEmpty()
方法在一个 String
,Eclipse显示以下错误:
方法isEmpty()未定义为类型String
我已经运行Java更新,但仍然得到它。是否有任何原因导致此方法未定义?
String.isEmpty()已添加到
I'm working on a school project in eclipse, and when I try and use the isEmpty()
method on a String
, Eclipse shows up the following error:
The method isEmpty() is undefined for the type String
I've run the Java updates, but am still getting it. Is any reason why this method would be undefined?
String.isEmpty() was added in Java 6. In earlier versions you can use StringUtils.isEmpty(String)
from Apache's commons-lang library.
To configure Eclipse to use the 1.6 JRE, go to Window->Preferences->Java->Installed JREs. If you haven't already got JAva 1.6 configured, select Add...,browse to your 1.6 installation and add it.
这篇关于Java isEmpty()未定义为String?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!