Question 1
Consider the Java code given below.
import java.io.*;import java.util.*;
public class FClass{ static boolean writeToFile(String filename) { try { FileOutputStream fos = new FileOutputStream(filename); PrintStream bos = new PrintStream(fos); bos.println("2 numbers are"); bos.println("3.14 and"); bos.println("10"); return true; }catch(IOException e) { return false; } } static boolean readFromFile(String filename) { try { FileInputStream fis = new FileInputStream(filename); Scanner sc = new Scanner(fis); System.out.println(sc.nextInt()); System.out.println(sc.nextLine()); System.out.println(sc.nextDouble()); System.out.println(sc.nextLine()); return true; }catch(IOException e) { return false; } } public static void main(String[] args) throws IOException{ if(writeToFile("E:\\myfile.txt") == false) System.out.println("write failed"); if(readFromFile("E:\\myfile.txt") == false) System.out.println("read failed"); }}Suppose the file E:\\myfile.txt is written successfully by the program. What will the output be?