Menu
Topics Index
...
`

Print statement1913


If you need explanation Read this topic

If you need Answer Take test on this topic

Print statement1913
What will be the output of the following program?
public class Simple {
    public static void main(String str[]) {
        System.out.format("Total=%d%nPercent=%d%%", 300, 40);
    }
}

A. Total=300
Percent=40%
B. Total=300%nPercent=40%
C. Some other output
D. Compilation Error or Runtime Error
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.

b.%d will print the int value 100 and %n wil den prntdd..
den percent is printed n den 40 wid %d

n finaly to print  % we need to write %%...

Posted by Bilal Ahmad    2014-08-14 12:50:56


d.compilation eror...
no suitable methid found fr print stmt..incorrct format of  prnt stmnt

Posted by Shamee Shamee    2014-08-14 12:57:41


D.wrong format fr print stmt.
println(string,int,int)

actual n formal argmnt list difr in length

Posted by Uzma Khan    2014-08-14 13:06:45


ans is  A ........out.printf(l, format, args) behaves in exactly the same way as the invocation  out.format(l, format, args)

Posted by Ramya Reddy Addulla    2014-08-14 13:12:16


a.printf n format r same n hvng same behaviir

Posted by Asma Mujtaba Khan    2014-08-14 14:36:22


A

Posted by Zeg Abder    2014-08-14 18:59:33


Congratulations Ramya Reddy Addulla. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-08-15 06:04:55


© meritcampus 2019

All Rights Reserved.

Open In App