In the following code, assume that inputFile references a Scanner object that has been successfully used to open a file:
double totalIncome = 0.0;
while (inputFile.hasNext()){
try {
totalIncome += inputFile.nextDouble();
}
catch(InputMismatchException e)
{
System.out.println("Non-numeric data encountered in the file."); inputFile.nextLine();
}
finally
{
totalIncome = 1.5;
}}
What will be the value of totalIncome after the following values are read from the file? 2.5
8.5
abc
1.0
1.0
0.0
1.5
35.5



Answer :

Other Questions