CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    197

    [RESOLVED] I am confused..

    I am trying this:

    Code:
     try(BufferedReader br = new BufferedReader(new FileReader("T.txt")); BufferedWriter bw = new 
    
    BufferedWriter(new FileWriter("T.txt"))) {  
                    read = br.readLine();
                    ArrayList ara = new ArrayList();
                 do {
                            br.readLine();
                      ara.add(read);
                             }while(br.hasRemaining());
    Error:

    Code:
    Test2.java:70: error: cannot find symbol
                             }while(br.hasRemaining());
                                      ^
      symbol:   method hasRemaining()
      location: variable br of type BufferedReader
    1 error
    complete!
    Press any key to continue . . .
    What am I doing wrong I've even imported the Buffer API package. I would really appriciate a nice apt explaination of what exactly the "." operator does. Because, I don't fully understand it. Or if you can explain it here. *edit* I suppose I understand that br.hasRemaining doesn't work, because bufferedReader doesn't have a hasRemaining method. I would still like a nice explainatoin of the "." operator.
    Last edited by kolt007; October 13th, 2011 at 06:11 PM.

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: I am confused..

    Read the API for BufferedReader. There is no hasRemaining() method.

  3. #3
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: I am confused..

    I would still like a nice explainatoin of the "." operator
    You can think of it as meaning the method or variable that is in the preceding class or object. ie

    Code:
    System.out.println("SomeText");
    means the method called 'println' that is in the object referenced by the 'out' variable that is in the class 'System'
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured