Home » questions » displaying output to a text file in java?

displaying output to a text file in java?

2006-08-15 09:03:01, Category: Programming & Design
is there a way to display output to a text file in java. For example i have two variables (both strings) and i want to print them to a text file. any suggestions. below is what i have tried using but i'm getting errors. java.io.File outfile; java.io.PrintWriter pen; outfile = new java.io.File("ask.txt"); pen = new java.io.PrintWriter(outfile); outfile.println(time + date);

Answers

  1. fuzzhead

    On 2006-08-15 09:58:28


    try pen.println instead of outfile.println