I keep getting this wrong. I don\'t understand how to implement the phrases on s
ID: 3702391 • Letter: I
Question
I keep getting this wrong. I don't understand how to implement the phrases on separate lines.
Write a public static method named B that takes no parameters and has return type * void. This method will create new file named "format.txt" that contains the phrases * "fragile aspect" and "sign judge" with each phrase on a separate line x/ public static void B() f String filename "format.txt"; String textTowriteln"fragile aspect" + "sign judge"; try Files.write(Paths.get(filename), textTowriteln.getBytes)) catch (IOException e) f e.printstackTrace();Explanation / Answer
public static void B() { String filename = "format.txt"; try { PrintWriter printWriter = new PrintWriter(filename); printWriter.println("fragile aspect"); printWriter.println("sign judge"); printWriter.flush(); printWriter.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }