Menu
Question Index
...

What will be the output of the following program?

public class PrintStatment5
{
    public static void main(String args[])
    {
        int x = 5;
        System.out.printf("%d ", x++);
        System.out.printf("%d ", --x);
        System.out.printf("%d ", x--);
        System.out.printf("%d ", ++x);
        System.out.printf("%d ", x++);    
    }
}


5 5 5 5 5
5 4 3 3 3
5 4 4 2 3
5 4 4 4 4
Compilation Error or Runtime Error

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