I would like to read an entire text file and store its entire contents into a single string. Then I would like to print the string to the console window. I tried this:
import java.util.Scanner;
import java.io.*;
public class WritingTextFiles{
    public static void main (String [] args) throws IOException{
        FileWriter fw= new FileWriter("testing.txt");  
        Scanner in= new Scanner (System.in);
        String testwords=in.nextLine();  
        fw.write(testwords);  
        BufferedReader r = new BufferedReader( new FileReader( "testing.txt" ) );  
        System.out.print(r);  
        fw.close();  
    }
}
The only thing that is printed to the console window is java.io.BufferedReader@18fb397.
Can anyone explain this to a newbie like me? I have very little experience but I am certainly willing to learn. I am open to any and all suggestions. Thanks in advance!
 
     
     
    