TCO 1 What output does the following code generate int a 10

(TCO 1) What output does the following code generate?

int a = 10;

double d = 123.456;

String s = “Hi there!”;

String res = String.format(“%s %d %.2f\ ”, s, a, d);

System.out.print(res);

A) Hi there! 10 123.46

B) %s %d %.2f Hi there! 10 123.456

C) s a d

D) None of the above

Solution

Option A is the correct answer.

Hi there! 10 123.46

(TCO 1) What output does the following code generate? int a = 10; double d = 123.456; String s = “Hi there!”; String res = String.format(“%s %d %.2f\ ”, s, a, d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site