Write txt file java

Questions/Tutorials for any programming language not covered in other sections.
1 post Page 1 of 1
Contributors
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Write txt file java
Shim
this snippet is java , what this actually do is , this will create a txt file called Output.txt and write inside heho this from codenstuff ok here is the code
Code: Select all
import java.io.*;
public class Output {

public static void main(String args[]){
FileOutputStream output;
PrintStream print;
try
{
output = new FileOutputStream("Output.txt");

print = new PrintStream( output );

print.println ("heho this is from codenstuff");

print.close();
}
catch (Exception e)
{
System.err.println ("cant write Output.txt");
}
}
}
proof :P

Image

enjoy
Find my programs on Softpedia
1 post Page 1 of 1
Return to “Misc”