Drag and drop from the options below to read and print the content of the file a.txt, and then close it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Drag and drop from the options below to read and print the content of the file a.txt, and then close it.

try { File f = new File("a.txt"); Scanner sc = new (f); while (sc.hasNext()) { String a = .next(); String b = sc.(); System.out.println(a + " " + b); } sc.(); } catch (Exception e) { System.out.println("Error"); }

15th Nov 2020, 5:47 AM
Mizanur Rahman Sajid
Mizanur Rahman Sajid - avatar
4 Answers
+ 4
Scanner sc next close
18th Dec 2020, 2:31 AM
Crystal Cromwell
Crystal Cromwell - avatar
0
methods missing in your code
15th Nov 2020, 6:20 AM
Prathvi
Prathvi - avatar
0
Scanner sc next close
23rd Nov 2021, 9:21 AM
Nabila Muftia Ma'ruf Kartono
Nabila Muftia Ma'ruf Kartono - avatar
0
Scanner sc next close
1st Jan 2022, 12:31 PM
M.I.M.Aqueel
M.I.M.Aqueel - avatar