• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java, basic question, filewriter

SnoopCat

Senior member
can someone please post an example of outputing a string that holds "steve" into a file which will be created by java and be called "myName.txt"
 
Is this just a fancy way of telling us that your name is Steve? Well, I'm Joseph, nice to meet you. 🙂
 
import java.io.*;

public class WriteName
{
public static void main(String[] args)
throws IOException
{
FileWriter out = new FileWriter("myname.txt&quot😉;
PrintWriter pr = new PrintWriter(out);
pr.print("Steve&quot😉;
pr.flush();
pr.close();
}
}

Glad to do your homework for you.
 
dwell, thanks 🙂 not my homework, I'm learning Java over the summer, and I was wondering how to write to txt files.
 
Back
Top