Menu
Question Index
...

What will be the output of the following program?

public class StartProgram {

    public static void main(String arvs[]) {
        String args = "Hai this is %s example %s";
        System.out.print(String.format(args, "string", "= ", "This is "));
        String args1 = "and number is %d + %d";
        System.out.println(String.format(args1, 10, 15));
    }
}


Hai this is string example = and number is 25
Hai this is string example = and number is 10 + 15
Hai this is string example = This is and number is 10 + 15
Hai this is %s example %s and number is %d + %d
Hai this is string example = This is and number is 25

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