Java
T
point
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Android
Interview Q
Content Menu ▼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Question 1
:
public class LineUp {
public static void main(String[] args) {
double d = 12.345;
// insert code here
}
}
Which code fragment, inserted at line 4, produces the output | 12.345|?
1.
System.out.printf("|%7.3f| ", d);
2.
System.out.printf("|%7d| ", d);
3.
System.out.printf("|%7f| ", d);
4.
System.out.printf("|%3.7d| ", d);