Used in the Java Applet

xiaoxiao2021-03-06  85

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

转载请注明原文地址:https://www.9cbs.com/read-106231.html

New Post(0)