Java isEmpty () неопределенный для Строки?

Я не объявляю служебный краткий обзор классов, я объявляю их окончательный и делаю конструктора частным. Тем путем они не могут быть разделены на подклассы, и они нельзя инстанцировать.



public final class Utility
{
    private Utility(){}

    public static void doSomethingUseful()
    {
        ...
    }
}
19
задан Aaron Moodie 4 December 2011 в 04:11
поделиться

3 ответа

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.

installed JREs screenshot

configure JREs screenshot
(source: lumidant.com)

32
ответ дан 30 November 2019 в 02:29
поделиться

If you're not on Java 6, String.length() == 0 will return the same result as String.isEmpty().

13
ответ дан 30 November 2019 в 02:29
поделиться

String.isEmpty() was introduced in Java release 1.6. You might want to check what JDK version you're using for your project. (I don't know much about Eclipse myself, but it should be somewhere in the project settings.)

8
ответ дан 30 November 2019 в 02:29
поделиться
Другие вопросы по тегам:

Похожие вопросы: