相关疑难解决方法(0)

String类型中的方法格式(String,Object [])不适用于参数(...)

这是我的代码:

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

这给出了编译错误:

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

为什么我在这里收到此错误,如何解决?

java string format

13
推荐指数
2
解决办法
3万
查看次数

标签 统计

format ×1

java ×1

string ×1