Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
I have a problem with java programming Posted by lunar_star on 22 Jun 2005 at 8:25 PM
I have a text files input.txt with contains

NOUN: Danh tu
VERB: Dong tu
ADJ: Tinh tu

And i have a java file ReadTextFile.java

import java.io.*;
import java.util.*;

public class ReadTextFile
{
public static void main (String [] args) throws IOException
{
File inFile = new File ("input.txt");
FileReader fReader = new FileReader (inFile);
BufferedReader bReader = new BufferedReader (fReader);
System.out.print("enter ur word search:");
System.out.flush();
DataInputStream din = new DataInputStream(System.in);
String move = null;
try
{
String line = bReader.readLine();
move = din.readLine();
while (line != null)
{


int i = line.indexOf(move.toUpperCase());
int j = line.lastIndexOf(".");
line = line.substring(i,line.length());
System.out.println (i);
line = bReader.readLine();

}
}
catch (Exception e)
{

System.exit(0);
}

}
}

i complier it and exec it
Enter ur word search: noun
NOUN: Danh tu

but when i change contain text file with:
ADJ: Tinh tu
VERB: Dong tu
NOUN: Danh tu

Enter ur word search: noun
it don't show NOUN: Danh tu
it enter and exit.

Help me it....





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.