Формат метода (String, Object []) в типе String неприменим для аргументов (…)

Вот мой код:

int hoursFormat = 1, minsFormat = 2, secsFormat = 3;
String timeFormat = String.format("%02d:%02d:%02d",hoursFormat, minsFormat, secsFormat);

Это дает ошибку компиляции:

Unresolved compilation problem: 
    The method format(String, Object[]) in the type String is not applicable for the 
      arguments (String, int, int, int)

Почему я получаю здесь эту ошибку и как ее исправить?

13
задан Dukeling 21 January 2018 в 13:14
поделиться