Here are my code:
import java.io.Console;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.*;
public class Welcome
{
public static void main(String[] args) throws IOException
{
Scanner in=new Scanner(Paths.get("F:\\myfile.txt"),"UTF-8");
String sentence=in.nextLine(); // I guess this line of code can read the first line of the txt in to the String sentence?
System.out.print(sentence);
}
}
and the content of myfile.txt is:
Eat an apple every day, keep the doctors away!
but the information displayed in the console window is:
Why there was a symbol '?' before normal content?
Thanks! explain as readable as please, I'm not a native speaker.