Witam,
Testuję taki kod:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Clas {
public static void main(String[] args) {
BufferedReader br = null;
try {
String sCurrentLine;
br = new BufferedReader(new FileReader("plik.txt"));
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
i moje pytanie, gdzie mam umieścić plik z tekstem? Gdy wrzucam do do folderu z plikiem .class pisze, że nie znajduję pliku.. więc w czym tkwi problem?