1

I want user to choose his desired text file.

My code:

File file = new File("mytextfile.txt");
System.out.println("This is your file");
System.out.println(file);
FileInputStream fin = null;


try {
    fin = new FileInputStream(file);
    System.out.println(fin);        
} catch (FileNotFoundException e) {
     e.printStackTrace();
}

Why this is not working?

Thanks in advance

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94
Abdus Salam
  • 11
  • 10
  • Are you trying to read the contents of the file? If so you need to use FileReader. – Walshy Mar 22 '16 at 14:19
  • What do you mean by "open text file" Do you want to open the file in an APP, do you want to open it in Java, do you want to read its content into a string, etc...? This question is not clear enough! – ParkerHalo Mar 22 '16 at 14:21
  • i want to open file in emulator. also i want to read its contents in string and then split the string using delimiters.. – Abdus Salam Mar 22 '16 at 14:25
  • i need a kind of file explorer only for text files.. – Abdus Salam Mar 22 '16 at 14:26

0 Answers0