You are on page 1of 4

package leepoint; import java.io.*; class NutPad { public static void main(String args[]) { tr { !ile"nputStream #is $ ne% !

ile"nputStream(&'()*ocuments and Settings)+dministrator)*esktop)sim)leepoint)NutPad.java&); #or(int i $,;(i$#is.read()) -$./;i00) { S stem.out.print((c1ar)i); 2 2 catc1("345ception e) { S stem.out.println(&!ile not present&); 2 2 2 package leepoint; import java.io.*; class NutPad { public static void main(String args[]) { int i $ , ; tr { !ile"nputStream #is $ ne% !ile"nputStream(&'()*ocuments and Settings)+dministrator)*esktop)sim)leepoint)NutPad.java&); !ile3utputStream #os $ ne% !ile3utputStream(&'()*ocuments and Settings)+dministrator)*esktop)sim)leepoint)NutPad6.java&); #or(;(i $ #is.read()) -$ ./;) { #os.%rite((c1ar) i); 2 2 catc1(45ception e) { S stem.out.println(&Please enter correct #ile names.&); 2 2 2

package leepoint; import java.io.*; class NutPad { public static void main(String args[]) { int i $ , ; >ook 1ere i# t1ere is no tr #ile also java %ill { create a ne% #ile and !ile"nputStream #is $ ne% !ile"nputStream(&'()*ocuments andinsert t1e data into it Settings)+dministrator)*esktop)sim)leepoint)NutPad.java&); !ile3utputStream #os $ ne% !ile3utputStream(&'()*ocuments and Settings)+dministrator)*esktop)sim)leepoint)NutPad7.java&); #or(;(i $ #is.read()) -$ ./;) { #os.%rite((c1ar) i); 2 2 catc1(45ception e) { S stem.out.println(&Please enter correct #ile names.&); 2 2 2 package leepoint; import java.io.*; public class NutPad { public static void main(String args[]) { ne% NutPad(); 2 NutPad() { tr { S stem.out.println(&*o ou %ant to enter te5t into #ile ( )n) 8&); 9u##ered:eader reader $ ne% 9u##ered:eader(ne% "nputStream:eader(S stem.in)); c1ar ans; ans $ (c1ar)reader.read(); i#(ans $$ ;<; == ans $$ ; ;) { open!ile(); 2 else

{ S stem.out.println(&?uitting&); 2 2 catc1(45ception e) { S stem.out.println(&k a re&); 2 2 public void open!ile() { S stem.out.println(&1ai&); 2 2 public void open!ile() { tr { S stem.out.println(&4nter t1e #ile name %1ere ou %ant to %rite&); 9u##ered:eader reader $ ne% 9u##ered:eader(ne% "nputStream:eader(S stem.in)); String #ileName; #ileName $ reader.read>ine(); :andom+ccess!ile ne%!ile $ ne% :andom+ccess!ile(#ileName@&r%&); String notes $ reader.read>ine(); 2 catc1(45ception e) { 2 2 public void open!ile() { tr { S stem.out.println(&4nter t1e #ile name %1ere ou %ant to %rite&); 9u##ered:eader reader $ ne% 9u##ered:eader(ne% "nputStream:eader(S stem.in)); String #ileName; #ileName $ reader.read>ine(); :andom+ccess!ile ne%!ile $ ne% :andom+ccess!ile(#ileName@&r%&); String notes $ reader.read>ine(); ne%!ile.%rite9 tes(notes); 2

catc1(45ception e) { 2 2 **********************************************************************