I'm trying to use some new Java string formatting tricks, pretty basic stuff. It compiles without any error messages but won't allow me to execute the code. Could someone please explain to me why this is wrong? Thanks in advance.
My code:
class TestingStringFormat {
public static void main(String args[]) {
System.out.printf("Total cost %-10d ; quantity %d\n", "ten spaces",5, 120);
for(int i=0; i<20; i++){
System.out.printf("%-2d: ", i, "some text here/n", 1);
}
}
}