ICSE Class 10 Computer Applications
Question 10 of 16
Using Library Classes — Question 12
Back to all questions 12
Question Question 12
Predict the output :
double n1 = Double.parseDouble("8.0");
double n2 = Double.parseDouble("2");
System.out.println(n1 + " " + n2);Output
8.0 2.0
Explanation
parseDouble() converts String arguments passed to it into double data type. Thus, 8.0 will be assigned to n1 and 2.0 will be assigned to n2.
The values of n1 and n2 will be printed with a space " " between them.