Scanner inputStream null try inputStream new Scanner new f

Scanner inputStream = null; try {inputStream = new Scanner (new fileInputstream (\"data. Txt\"));} catch (fileNotFoundException e) {System. out. prinIn (\"Error opening files\"); System. exit (0);} while (inputStream.hasNextLine()) {String aline = null; aline = inputStream, nextLine():} System.out.printIn (alin + \"\" + alin); and the following contents of data txt; double toil trouble What does the program output? double double toil toil trouble trouble

Solution

The stmts in while loop are repeat thrice and when aline.nextline =null..

Control comes out of the loop and last value in aline will be printed

So the answer is trouble trouble

option D

 Scanner inputStream = null; try {inputStream = new Scanner (new fileInputstream (\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site