Menu
Question Index
...

What is the output of the following program?

public class TestFormat {
    public static void main(String arg[]) {
        long n = 682013;
        System.out.format("%+,8d%n", n);
        System.out.format("%07d%n", n);
        System.out.format("%+7d%n", n);
    }
}


+6,82,013
0682013
+682013
+682,013
0682013
+682013
+682,013
682013
+682013
6,82,013
0682013
+682013

Doubts

Problems

Topic: Java Formatter

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App