java system.out.printf format numerics rounding off and spacing issue together

public class Solution {    
    public static void main(String[] args) {
        String[] languages = { "java", "cpp", "python" };
        int[] values = { 100, 65, 60 };

        for (int i = 0; i < 3; i++) {
            System.out.printf("%-5s %03d %n", languages[i], values[i]);
            //Complete this line
        }
    }
}

Output I'm getting

java 100
cpp 65
python 50

Desired output

java           100 
cpp            065 
python         050 
Jon Skeet
people
quotationmark

The code you've got doesn't match the output you've shown - it's nearly right already. It comes up with:

java  100 
cpp   065 
python 060

The only problem here is that you're right-padding the names to a minimum of 5 characters... but python has 6 characters. So you just need to increase the 5 in your format string. For example:

System.out.printf("%-10s %03d %n", languages[i], values[i]);

Separately, your comments have suggested that you don't know what each of the bits of your format string does. You should read the Formatter documentation carefully. For example, the - in %-10s is a flag, with a meaning of "The result will be left-justified."

people

See more on this question at Stackoverflow