Analyze the following code:

```
int i = 3434; double d = 3434;
System.out.printf("%5.1f %5.1f", i, d);
```
a. The code compiles and runs fine to display 3434.0 3434.0.
b. The code compiles and runs fine to display 3434 3434.0.
c. i is an integer, but the format specifier %5.1f specifies a format for double value. The code has an error.
Key:c i is an integer, but the format specifier %5.1f specifies a format for double value. Type does not match. So, the correct answer is C.

c. i is an integer, but the format specifier %5.1f specifies a format for double value. The code has an error.
Is an integer, but the format specifier %5.1f specifies a format for double value. Type does not match. So, the correct answer is C.

Computer Science & Information Technology

You might also like to view...

Any device that is attached to a network is referred to as a ____.

A. server B. node C. host D. router

Computer Science & Information Technology

A ________ is a group of related files, such as code files, resource files and images that make up an app.

a. folder b. directory c. solution d. project

Computer Science & Information Technology