java Question

http://www.student.cs.uwaterloo.ca/~cs134/Assignme...

does anyone know how to read the data file and store the variable in the instance variable in java code?

thx

2 個解答

評分
  • ?
    Lv 7
    1 十年前
    最愛解答

    the following sample code shows read file content according to a filename

    e35. Reading Text from a File try {

    BufferedReader in = new BufferedReader(new FileReader("infilename"));

    String str;

    while ((str = in.readLine()) != null) {

    process(str);

    }

    in.close();

    } catch (IOException e) {

    }

    Related Examplese34. Reading Text from Standard Input

    e36. Reading a File into a Byte Array

    e37. Writing to a File

    e38. Appending to a File

    e39. Using a Random Access File

  • 1 十年前

    係refresh上面有*檢視*,你click入去再click*原始檔*..你係咪指呢個呀..?

還有問題嗎?立即提問即可得到解答。