Menu
Question Index
...

What will be the output of the following program?

public class StringFormat
{
    public static void main(String[] args)
    {
        double pi = Math.PI;
        System.out.format(Locale.CHINESE, "%f%n", pi);
        System.out.format("%-10.4f", pi);
        System.out.format("%-1.0f%n%n", pi * 100);
    }
}


3.141593
3.1416    
314.1593  
3.141593
3.1416    314.1593
3.141593
3.1416    314
3.141593
3.1416    
314
Some other output

Doubts

Problems

Topic: Other Advanced Topics In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App