Results 1 to 2 of 2
  1. #1
    Anandiscool is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default Which is better?

    Hi,
    Among Scanner ,BufferedReader and DataInputStream which is bettter one and why?
    Please Give the Difference between all three.
    Also,
    BufferedReader br=new BufferedReader(InnputStreamReader(System.in))
    [please explain this line(each word)]

    I know how to use these but don't know why and when to use and basic difference.

    Thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Anandiscool View Post
    Hi,
    Among Scanner ,BufferedReader and DataInputStream which is bettter one and why?
    Please Give the Difference between all three.
    Also,
    BufferedReader br=new BufferedReader(InnputStreamReader(System.in))
    [please explain this line(each word)]

    I know how to use these but don't know why and when to use and basic difference.
    As you wrote yourself already: each has its own use; a DataInputStream can read primitive values in their binary form. A Scanner can read those in their textual form. A BufferedReader is a text only thing and its real functionality is the buffering of the (text) data. You can't say which one is best because those classes have different functionality.

    kind regards,

    Jos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •