Page 369 - Cs_withBlue_J_C11_Flipbook
P. 369
57 catch(EOFException e)
58 {
59 eof=true; // while loop becomes false
60 if(!found)
61 System.out.println("Sorry not selected");
62 }
63 // closing stream objects
64 di.close();
65 fi.close();
66 }
67 // main() method to call other methods
68 public static void main() throws IOException
69 {
70 Scanner sc=new Scanner(System.in);
71 Search ob=new Search();
72 ob.createFile();
73 System.out.println("Enter application number to search");
74 int a=sc.nextInt();
75 ob.find(a);
76 }
77 }
The output of the preceding program is as follows:
Enter application no, name, ans average marks
10201 Deepak 99.8
Continue y/ny
Enter application no, name, ans average marks
10202 Gagan 99.4
Continue y/ny
Enter application no, name, ans average marks
10203 Rajesh 99.5
Continue y/ny
Enter application no, name, ans average marks
10204 Jaya 99.2
Continue y/ny
367
Basic Input/Output and Data File Handling 367

