Hallo!
Was mache ich falsch? Nach untenstehendem Code erhalte ich folgende Fehlermeldung:
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier 'b'
at java.util.Formatter.format(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at Formatieren.main(Formatieren.java:9)
Was habe ich vergessen?
Was mache ich falsch? Nach untenstehendem Code erhalte ich folgende Fehlermeldung:
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier 'b'
at java.util.Formatter.format(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at Formatieren.main(Formatieren.java:9)
Was habe ich vergessen?
Code:
import java.util.Formatter;
public class Formatieren {
public static void main(String[] args) {
boolean b = false;
StringBuilder s = new StringBuilder();
Formatter f = new Formatter(s);
f.format("Der Wert ist: %b");
System.out.print(s);
}
}