HI all, I have just come across this:
System.out.printf("Student %2d: %3d\n");
What does that ":" mean? I assume it is a kind of separator becasue that line prints something like this:
Student 1: 87

Recommended Answers

All 3 Replies

The colon and following space are just text which will be ouput along with the variable data which will be inserted in the string where the format specifiers are found (%2d and %3d).

@stultuske, yes I know, but I am not really tha familiar with the documentation as yet, I find it rather confusing...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.