i just learned File Handling yesterday . There is a confusion about classes usage for me . For Example some of the examples were like this
Paths myfile= paths.get("c:\\Sample.txt");
OutputStream opt= new BufferedOutputStream(myfile.hew OutputStream(CREATE));
BufferedWriter br= new BufferedWriter( new OutputStreamWriter(opt));
br.write();..... ;
and so on
This is one way and Somewhere i find
BufferedWriter bf = new BufferedWriter( new FileWriter("c:\\Sample.txt"));
bf.write("Hello File Handling ");'
i am not concerned if in above code it is creating file and second one is writing . i want to ask
in First one we are using parent (OutputStream)class and then code goes ,
and in second one we use BufferedWriter Directly instead of using Parent one , So what's the logic to do so , i mean does it make any difference if we use parent classes while doing something big or we can go for any logic
Thanks for your help