Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java FileOutputStream to write data to a File

import java.io.FileOutputStream;
public class Main {
    public static void main(String[] args) {
       String data = "This is a line of text inside the file.";
        try {
            FileOutputStream output = new FileOutputStream("output.txt");

            byte[] array = data.getBytes();

            // Writes byte to the file
            output.write(array);

            output.close();
        }
        catch(Exception e) {
            e.getStackTrace();
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java easy list 
Java :: get max of array java 
Java :: nextint java 
Java :: alphabet n vowelin java 
Java :: maven skip make-assembly 
Java :: Calendar ranges java 
Java :: transformer un string en Biginteger java 
Java :: add infinite values to variable java 
Java :: How to find the maximum occurring character in a given String? using hashmap java 
Java :: osmdroid get current zoom level 
Java :: afficher matrice java 
Java :: java unique queue 
Java :: generate random number using math.random in java 
Java :: convert jwt claim to string java 
Java :: dependency injection java 
Java :: iterative inorder traversal 
Java :: set union java 
Java :: java.lang.double cannot be cast to java.lang.float 
Java :: math square java 
Java :: Java Hashmap Replace Elements 
Java :: Compare two csv files using java 
Java :: spring boot embedded tomcat port already in use 
Java :: prime factorization java 
Java :: how to insert a 0 in an array java 
Java :: Could not resolve project :app 
Java :: print statement in java, simplest java program, Hello World in Java 
Java :: how to find a word in a statement java 
Java :: set style programmatically android 
Java :: remove duplicates from arraylist in android 
Java :: Java List Access Elements using get() method 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =