My coding is as follows:
After compilation and execution, in the Console i get 20 but in the file 'EG.txt' i get nothing. It is empty. What went wrong?
Code:
import java.io.*;
class Sample
{
public static void main(String args[])
{
try
{
int[] a = new int[20];
PrintWriter out = new PrintWriter("EG.txt");
System.out.println(a.length);
out.println(a.length);
}
catch(FileNotFoundException e)
{
}
}
}
Comment