Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

    Default How to use BufferedReader?

    How do I use BufferedReader to read whole paragraph? I dont know how to start it except typing:

    class Reader throws IO Exception
    {
    BufferedReader reader - new BufferedReader();
    }


    I know Im supposed to use readline() but I just dont know how to put it......
    BTW can Bufferedreader read strings inside a vector?

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Java Code:
    File file = new File(filePath);
    try {
        BufferedReader br = new BufferedReader(
                            new InputStreamReader(
                            new FileInputStream(file)));
        String line;
        while((line = br.readLine()) != null)
            System.out.println(line);
        br.close();
    } catch(IOException e) {
        ...
    }
    
    Vector<String> v = new Vector<String>();
    for(int j = 0; j < 5; j++) {
        v.add(String.valueOf(j));
    }
    // retrieve the third element
    String s = v.get(2);

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

    Default

    Thnx much Ill study it now

  4. #4
    Jigs1509 is offline Member
    Join Date
    Oct 2011
    Location
    Tagbilaran City, Bohol, Philippines
    Posts
    1
    Rep Power
    0

    Default Re: How to use BufferedReader?

    Write a program that will compute for n! which is the product of all
    numbers from 1 to n. Help me please..

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

    Default Re: How to use BufferedReader?

    Quote Originally Posted by Jigs1509 View Post
    Write a program that will compute for n! which is the product of all
    numbers from 1 to n. Help me please..
    Don't hijack someone else's thread; it is considered rude; start your own thread please.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Reading int values using BufferedReader
    By Java Tip in forum Java Tip
    Replies: 2
    Last Post: 01-24-2008, 07:26 PM
  2. Reading text from a URL using BufferedReader
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:17 AM
  3. BufferedReader .mark(int readAheadLimit)
    By ShoeNinja in forum New To Java
    Replies: 1
    Last Post: 11-16-2007, 10:58 PM
  4. Help with BufferedReader in java
    By carl in forum New To Java
    Replies: 2
    Last Post: 07-31-2007, 07:20 AM
  5. BufferedReader empty
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 06:52 PM

Posting Permissions

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