Hi all, I hope you are well. I am trying to compile a java file using terminal in Ubuntu, but I am getting the following error message:
1. ERROR in StringComparisons.java (at line 20)
System.out.printf("String a = %s String b = %s \n", a,b);
As you can see, I am passing three String arguments to the printf method, which, as far as I can tell from the API is perfectly legal as this would correspond to the object varargs printf method.
printf
public PrintStream printf(String format,
Object... args)A convenience method to write a formatted string to this output stream using the specified format string and arguments.
Interestingly, this compiles & executes fine in NetBeans (on the same machine, so same JDK version). Please can someone tell me if I have missed something here? Many thanks.