Advertisement
RupeshAcharya60

5. Write a simple java program that reads data from one file and writes data to another file.

Mar 25th, 2023
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class ExamQ {
  5.     public static void main(String[] args) throws IOException {
  6.         FileInputStream vowel = new FileInputStream("Vowel.txt");
  7.         FileOutputStream constant = new FileOutputStream("Cons.txt");
  8.  
  9.         int temp = vowel.read();
  10.               while(temp!=-1){
  11.                   constant.write(temp);
  12.                   temp = vowel.read();
  13.               }
  14.  
  15.  
  16.  
  17.       vowel.close();
  18.       constant.close();
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement