Question: Java reading files NEED HELP. I don't know how to answer this question I am using the right syntax discussed in class and its giving

Java reading files NEED HELP. I don't know how to answer this question I am using the right syntax discussed in class and its giving me an error. Please help me fix the code so it work I don't want a different variation of code i want to use the syntatically that i was trying to do just need correction PLEASE.Java reading files NEED HELP. I don't know how to answer this

1 import java.io.IOException; VariablesChallengePS/src/VariablesChallengePS java 2 import java .nio.file. le 3 import java.nio.file. Paths; 5 public class FilesLecture1 5 points static string Q1 (String filename) 10 TODO: Read the input file and return its contents as a single string containing all lines of the file 11 Concatenated together 12 try filename src/test.txt 14 for (string line Files .readALLLines hs.get (filename System.out.println(line); 17 catch (IOException ex 18 ex.printstackTrace 19 20 return "line 23 25 public static void main(String[] args) f String result 01 src/test File. txt") 26 System.out.println( result 27 28 Javadoc Q. Declaration Console erminated> FilesLecture1 ava Application] CAProgram Files NavaVre1.8.0 121 binyavaw.exe (Feb 27, 2017, 9:22:25 AM ava.nio.file.NoSuchFileException src\test.txt at ion (Unknown Source at ion (Unknown Source at ion (Unknown Source at sun.nio.fs. Windows FilesystemProvider.newBytechannel (Unknown Source) at java .nio. file. Files.newBytechannel (Unknown Source) at java nio.file, Files.newBytechannel(Unknown Source) at java .nio.file.spi. FilesystemProvider.newInputstream(Unknown Source) at java. nio.file. Files.newInputstream(Unknown Source) at iava nio.file. Files newBufferedReader (Unknown Source) Writable Smart Insert 24:4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!