Answer the question
In order to leave comments, you need to log in
How to assign a variable of type String the text of a .text file?
Sorry for not being able to figure it out...
Answer the question
In order to leave comments, you need to log in
Maybe a .txt file?
Class:
FileReader(String path to file) ?
// Демонстрация применения FileReader.
// Эта программа использует оператор try-с-ресурсами. Требует JDK 7.
import java.io.*;
class FileReaderDemo {
public static void main(String args[]) {
try ( FileReader fr = new FileReader("FileReaderDemo.java") ) {
int с ;
// Читает и отображает файл.
while((c = fr.read(J) != -1) System.out.print((char) c);
}
catch(IOException e) { System.out.println("I/O Error: " + e)}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question