1 2 3 4 Previous Next 53 Replies Latest reply on Jul 31, 2008 12:16 PM by 843785

    Reading text from file and storing

      Dear all,

      I would like to read from a text file and store the contents which from the file which would be used later.Currently i am able to read from a file but i am not able to store the contents temporarily.Can someone show how it is done?

      My codes:
      try {
              BufferedReader in = new BufferedReader(new FileReader("infilename"));
              String str;
              while ((str = in.readLine()) != null) 
          } catch (IOException e) {
      i want to store the temporarily but after the file is close, the contents are lost.The last line prints out null for str variable.Please help
        1 2 3 4 Previous Next