OneCompiler

CRUD

102

package javaapplication28;
import java.util.*;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;

public class JavaApplication28 {

public static void main(String[] args)  {
    
    
    try{
        
    Scanner in = new Scanner(System.in);
    
    ArrayList<Integer> emp_dets = new ArrayList<>();
    FileWriter FILE = new FileWriter("Employee.txt", true);
    BufferedWriter OUTPUT = new BufferedWriter(FILE);
    
    System.out.print("Employee number: ");
    emp_dets.add(in.nextInt());
    
    System.out.print("Last Name: ");
    emp_dets.add(in.nextInt());
    
    System.out.print("First Name: ");
    emp_dets.add(in.nextInt());
    
    System.out.print("Middle Name: ");
    emp_dets.add(in.nextInt());
    
    OUTPUT.write(emp_dets + "\n");
    OUTPUT.close();
    
    }catch(InputMismatchException e){
        System.out.println(e.getMessage());
        System.out.println("HAHAHAHAH BOBO");
        
    } catch (IOException e){
        
    } finally {
        System.out.println("hehe"); 
    }
    
}

}