9.File Handeling


import java.io.*;
import java.util.*;

class FileHandle2{
public static void main(String args[]) throws IOException{
FileOutputStream fout=new FileOutputStream(“test.txt”);
String empname,salary;
Scanner sc=new Scanner(System.in);
System.out.println(“Enter Name Of an employee”);
empname=sc.nextLine();
System.out.println(“Enter Salary Of an employee”);
salary=sc.nextLine();
fout.write(empname.getBytes());
fout.write(salary.getBytes());
}
}