Results 1 to 4 of 4

Thread: [RESOLVED]Help!! Compare and match readLine() and text in a text file

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2006
    Posts
    21

    Resolved [RESOLVED]Help!! Compare and match readLine() and text in a text file

    I have a text file, i open the file and try to match the contents of the text file to a text. Here's my code:

    FileInputStream input = new FileInputStream ("BinaryFp.txt");
    BufferedReader br = new BufferedReader(new InputStreamReader(input));
    for(int i=1;i<801;i++)
    {
    pdtNo = br.readLine();
    if(pdtNo=="M5250")
    System.out.println("true");
    else
    System.out.println("false");
    }
    The problem is, i don't know why the answer is always false. There should be 1 match. Is ther any way that i can compare "M5250" with text in the text file?
    Last edited by huiling25; Jan 30th, 2007 at 04:20 AM.

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