SHARE
TWEET

Untitled

a guest Feb 16th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class Samplewriter {
  5.     static File names=new File ("qwe.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.         out.write(name +"," +year+ ","+ section) ;
  22.         out.newLine();
  23.         out.close();
  24.     }
  25.    
  26.    
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top