Hi guys I am pretty new to coding as I only started a month ago in school. Our project is to build a game. For my game, I have questions I read from a text file into an array. I changed the tabs and new lines with \t and \n to format it. It works perfect when I just copy paste the code into System.out.println. But when I try to do it with a text file, it is coming out exactly as I typed it in with the \t and \n Please any help is appreciated:)
Example Text file(Just a single line of it)
How is a play on words commonly described? \n\t\tA) Pan\t\t \t\t\tB) Pin\n\t\tC) Pen\t\t \t\t\tD) Pun
The Output if put into print statement
How is a play on words commonly described?
A)Pan B) Pin
C)Pen D) Pun
Output from listed code
How is a play on words commonly described? \n\t\tA) Pan\t\t \t\t\tB) Pin\n\t\tC) Pen\t\t \t\t\tD) Pun
**import java.util.Scanner;
import java.io.*;
public class ImportFile {
public static void main(String[] args) throws Exception{
Scanner easyfile = new Scanner(new File("src/EasyQuestions.txt"));
System.out.println(easyfile.nextLine());
}
}**