Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class Samplewriter {
  5. static File names=new File ("jec.txt");
  6.  
  7. public static void main (String [] args) throws Exception {
  8. Scanner sc=new Scanner (System.in);
  9. String name, year, section;
  10. FileWriter writer=new FileWriter(names, true);
  11. BufferedWriter out= new BufferedWriter (writer);
  12. System.out.println ("Enter a name: ");
  13. name=sc.nextLine();
  14. System.out.println ("Enter a year: ");
  15. year=sc.nextLine();
  16.  
  17. System.out.println ("Enter a section: ");
  18. section=sc.nextLine();
  19.  
  20.  
  21.  
  22. out.newLine();
  23. out.write(name +"," +year+ ","+ section) ;
  24. out.newLine();
  25. out.close();
  26. }
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement