julianff
julianff

Reputation: 170

Java: Using Eclipse

public String toMilitary()
{
       return String.format("%2d:%2d:%2d", hour, minute, second);

}

This code gives the following error:

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

Also, Enhanced for loop and Variable Parameters shown errors.

Is there a problem with my compiler. Should I re-install it?

Upvotes: 0

Views: 44

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 280181

No (unless you seriously have an old compiler), go to your project Properties (right click), go to Java Compiler and set the Compiler compliance level to anything greater than 1.5

Upvotes: 3

Related Questions