I am getting this type of error in my eclipse software :
Question
Why do I get an error?
code :
package loops;
public class Escapey {
public static void main(String[] args) {
String name ="micheal";
System.out.printf("i am %s, my friend name also %s",name);
}
}
Error message:
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%s' at java.base/java.util.Formatter.format(Formatter.java:2672) at java.base/java.io.PrintStream.format(PrintStream.java:1053) at java.base/java.io.PrintStream.printf(PrintStream.java:949) at loops.Escapey.main(Escapey.java:5)
- Ouput excepted :(
A pretty obscure way to do this:
I have literally never used this, but it is mentioned in the documentation of
Formatter
.