Какой код нужно вставить на место строки 1, чтобы корректно получить строковое представление переменной l?

public class Test { 
    static public  void main(String args[]) {
        long l = 0;
        String s = new String();
        // 1
    }
}
Explanation
Primitive types do not have methods, so l.toString() will not compile.
Long.parse() accepts String object containing number as a parameter and returns Long object, so this is not a way to create string.
Long.toString(l) converts primitive long value to the string representation.
Operator plus + when accepts a string as and argument, converts second argument to String and makes a concatenation of strings, so ("" + l) will also create a string representation of long value.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты