Show the output of the following statements. (a) System.out.printR\" amount is %
ID: 3872605 • Letter: S
Question
Show the output of the following statements. (a) System.out.printR" amount is %"%ein'', 32.32, 32.32); (b) System.out.printf("amount is %,5.2%% %5.4eln", 32.327, 32.32); (c) System.out.printR" %6b ", (1 > 2)); (d) System.out.printR" %6s ", "Java"); (e) System.out.printi("%-6b%sln", (1 > 2), "Java"); Write your answer as the two examples given below: System . out . printfC"%8d%8s53.1f ", 1234, ''Java" , 5.63); System.out.printfc..%-8d%-8s%-8.1f ", 1234, "Java", 5.63); display 1234JavaC5.6 1234 Java 56 where the square box ( denotes a blank space.Explanation / Answer
(a)it will print 32.32 , 32,32 as the values are float , so %f and %e will print the same content.
(b)Here first value will be printed as 32.327 (here in %5.2 meanse 5 whitespaces before the arrival of dot(.) so in the print there are 3 spaces available)
And in same way second value will be printed as 32.3200 but before the arrival of based on %5.4 there should be 5 whitespaces but 32 is included before dot , so there are 3 whitespaces before 32.3200 and in %5.4 4 means upto 4 decimal values .
(c)
This will print %6b and then in next Line
false //becuase 1 is not greater than 2 to use backspace use in %6b.
(d)this will print %6s and then in next and new line it will print
Java
(e)Output will be -6b%s and then in next new line
false Java
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.