I've been using Eclipse to learn Java and have run into an issue trying to use printf
.
I keep getting the error message: "The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)"
Here's where I'm seeing a problem:
public class Lesson25 {
public static void main(String[] args) {
System.out.printf("Total: %d & Quantity: %d\n", 5, 120);
}
}
and
public class Lesson10 {
public static void main(String[] args) {
for (int i=0; i<5; i++) {
System.out.println("The value of i is: " + i);
}
for (int x=5; x>0; x--) {
System.out.printf("The value of n is: %d\n", x);
}
}
}
Can anyone help me figure out what's wrong? Thanks