Java search text file

Advertisement

In this tutorial, you will learn how to search a text file in the current
directory.

Java search text file

In this tutorial, you will learn how to search a text file in the current
directory. For this, we have prompt the user to enter the name of a text file to
search for. If the name does not have a .txt extension, display an error
message. Then search the file in the current directory. If the file does not
exist in the current directory then also display an error message.