Write a Java program that allows a user to enter 10 email-ids from keyboard then write all
the information to a file called "poll.txt"
I wrote the code but its not printing any thing in the file
the information to a file called "poll.txt"
I wrote the code but its not printing any thing in the file
package dslab1;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
public class ex2 {
public static void main(String[] args) throws FileNotFoundException {
Scanner read = new Scanner(System.in);
int[] email = new int[10];// set up array of 10
System.out.println("Enter Email IDs: ");
for (int i = 0; i < 10; i++) // read 10 numbers
{
int x = read.nextInt();
email[i] = x; // put the number in the array
}
PrintWriter pw = new PrintWriter("poll.txt");
System.out.println(pw);
pw.close();
read.close();
}
}