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 7931335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:41:18+00:00 2026-06-03T20:41:18+00:00

The classes java.io.Reader and java.io.InputStreamReader both have read methods with the exact same signature

  • 0

The classes java.io.Reader and java.io.InputStreamReader both have read methods with the exact same signature

public int read(char[] charbuf, int offset, int length) throws IOException

Now according to the java documentation the class java.io.FileReader inherits both these read() methods from both the above-mentioned classes.

Now as FileReader extends InputStreamReader which further extends Reader

(Reader <-- Inputstreamreader <-- FileReader)

and the read() has same signature in both classes, shouldn’t it have been that InputStreamReader overrode the read() from Reader and FileReader inherited that over-ridden method?? Or am i missing something here??

Also the two read()s inherited by FileReader have slightly different functionality (something about one blocks while waiting for input while the other doesn’t).

  • 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-03T20:41:19+00:00Added an answer on June 3, 2026 at 8:41 pm

    The method in InputStreamReader provides the implementation for the abstract method in Reader. FileReader doesn’t override that method any further; it just inherits the implementation from InputStreamReader.

    Note that there are four signatures for read:

    public int read()
    public int read(char[] cbuf, int offset, int length)
    public int read(char[] cbuf)
    public int read(CharBuffer target)
    

    InputStreamReader only overrides the first two of these. Perhaps that’s what was confusing you?

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

Sidebar

Related Questions

I have two Java classes giveMyOb and dataConn declared in the same directory. Both
I have two java classes called Reader and Worker. Reader reads strings from a
I have Java classes like this: public class Config { public Config1 getConfigOpt1(); public
What is the default folder that classes that extend java.io.Reader take input from? For
Using reflection on Java classes to access all field, methods, and so on: Is
Are all final classes in Java immutable. String and Integer both are final classes
I have some java classes like, Class User { String email; String name; String
I have Java classes with the following structure (the class names do not imply
I have some java classes that work fine until I put them in a
I have this code in Java: InputStreamReader isr = new InputStreamReader(getInputStream()); BufferedReader ir =

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.