Menu
Topics Index
...
`

Strings1959


If you need explanation Read this topic

If you need Answer Take test on this topic

Strings1959
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";
        System.out.println(String.format(args1, 10 + 15));
    }
}

A. Hai this is string example = and number is 25
B. Hai this is string example = and number is 10 + 15
C. Hai this is string example = This is and number is 10 + 15
D. Hai this is %s example %s and number is %d + %d
E. Hai this is string example = This is and number is 25
Topic: Java Formatter

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

a

Posted by Maheshwari Natarajan    2014-05-12 04:01:02


1st output format takes string and symbl,2nd takes 10+15

Posted by Maheshwari Natarajan    2014-05-12 04:05:16


ans is A:  in first foramt  1st %s wl tak string n 2nd wl tak "="  in 2nd statement %d wl tak adtion of 10+15 as 25

Posted by Uday Kumar    2014-05-12 04:21:06


Congratulations Uday Kumar. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-05-13 04:14:20


© meritcampus 2019

All Rights Reserved.

Open In App