Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class FormatString
{
    public static void main(String[] args)
    {
        double valueOfPI = Math.PI;
        System.out.printf("%f\n", valueOfPI);
        System.out.printf(Locale.GERMAN, "%-10.3f", valueOfPI);
        
        double valueOfE = Math.E;
        System.out.printf("\n%f\n", valueOfE);
        System.out.printf(Locale.GERMAN, "%-10.3f", valueOfE);
    }
}


3.141593
3.142    
2.718282
2.718
3.141593
3,142    
2.718282
2,718
Compilation Error
Runtime Error

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