Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class Samplewriter {
- static File names=new File ("jec.txt");
- public static void main (String [] args) throws Exception {
- Scanner sc=new Scanner (System.in);
- String name, year, section;
- FileWriter writer=new FileWriter(names, true);
- BufferedWriter out= new BufferedWriter (writer);
- System.out.println ("Enter a name: ");
- name=sc.nextLine();
- System.out.println ("Enter a year: ");
- year=sc.nextLine();
- System.out.println ("Enter a section: ");
- section=sc.nextLine();
- out.newLine();
- out.write(name +"," +year+ ","+ section) ;
- out.newLine();
- out.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement