Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:23:06+00:00 2026-06-13T10:23:06+00:00

i just learned File Handling yesterday . There is a confusion about classes usage

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:23:07+00:00Added an answer on June 13, 2026 at 10:23 am

    It’s a bit unclear what you’re asking, but the Java IO classes use the Decorator pattern to achieve different ways of reading and writing from an Input or Output Stream. What this allows is flexibility with how data is loaded and written, since each one allows you to decorate the current type.

    Decorator Pattern for IO

    Decorator Pattern

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just learned about ThreadLocal this morning. I read that it should always be
I just learned yesterday from this site that I can: class Seq(object): def __init__(self,
I just learned about character sets today, so forgive the newb factor if this
I just learned about comet pattern(Long polling) and very curious to implement a simple
So I just learned about preg_match in PHP the other day and now i'm
As I just learned from this question , .NET regexes can access individual matches
I just learned that defining a c++ function inside a class's header file make
I have to call an executable file in Ubuntu... Just learned how to make
Has anyone done something like this? How? I'm just starting a project that will
I'm reading a text on Version 6 unix, and just learned about inodes. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.