Post the code you've written so far and we will be able to help you. You may need to make use of a combination of BufferedReader and FileReader classes from java.io.
Hi thanks for this, i have come up with this code so far buit i dont think its any good.
- import java.io.*;
-
import java.util.*;
-
-
public class App
-
{
-
//Create BufferedReader class instance
-
public static InputStreamReader input = new InputStreamReader(System.in);
-
public static BufferedReader keyboardInput = new BufferedReader (input);
-
-
-
-
public static void main(String[] args) throws IOException
-
{
-
-
System.out.println("Enter the name of the file you wish to read: ");
-
-
FileReader file = new FileReader();
-
BufferedReader MyFile = new BufferedReader(file);
-
-
StringTokenizer TokenizeMe;
-
int numTokens = 0;
-
int numWords = 0;
-
int numChar= 0;
-
-
TokenizeMe = new StringTokenizer(Myfile.readLine());
-
numTokens = TokenizeMe.countTokens();
-
-
while (numTokens != 0)
-
{
-
for (int WordsinLine=1;
-
WordsinLine<=NumberofTokens;WordsinLine++);
-
{
-
System.out.print(TokenizeMe.nextToken()+" ");
-
}
-
-
System.out.println();
-
-
numWords += NumberofTokens;
-
-
TokenizeMe = new
-
StringTokenizer(MyFile.readLine());
-
}
-
-
System.out.println("\nThere are " + NumberofWords + " words in the text");
-
-
MyFile.close();
-
}
-
}
-
}
-
THis is my code i made it in a matter of minutes, so alot of it is crap hope you can find something from it.