Making the applet, join a text list.txt file into the project, how can you read data from this file?
Write the following paragraph, the error is not a file (filenotfoundexception).
Try {
FileReader fr = new fileReader ("list.txt");
BufferedReader Br = New BufferedReader (FR);
String s = br.readline ();
While (s! = null) {
// Perform relevant processing
S = Br.Readline ();
}
br.close ();
} catch (ioexception e) {
E.PrintStackTrace ();
}
-------------------------------------------------- -------------
URL U1 = getDocumentBase ();
URL UFILE = New URL (U1, "XYZ.TXT");
DataInputStream Dins = New DataInputStream (ufile.openstream ());
//dins.readline (); final operation
Description: Place the XYZ.TXT file is available in the same directory with .html.
-------------------------------------------------- -------------------------------------------------- -----
Java FAQ from 9CBS