you need to use Scanner scan = new Scanner(new File(your_file));
and scan the file using while(scan.hasNext())
. place your counter inside the loop and count the lines
,words
and characters
.
More Related Contents:
- Fairly new to programming, trouble reading and writing to a binary file. [closed]
- File I/O Concept [closed]
- French and Chinese characters are not appearing correctly
- How do I read / convert an InputStream into a String in Java?
- How to append text to an existing file in Java?
- How to read all files in a folder from Java?
- Easy way to write contents of a Java InputStream to an OutputStream
- How to read integer value from the standard input in Java
- Quickly read the last line of a text file?
- Do I need to close() both FileReader and BufferedReader?
- byte[] to file in Java
- hadoop No FileSystem for scheme: file
- Create a new line in Java’s FileWriter
- Get an OutputStream into a String
- Printing my Mac’s serial number in java using Unix commands
- How to write data to two java.io.OutputStream objects at once?
- Java: Difference between PrintStream and PrintWriter
- Getting “java.nio.file.AccessDeniedException” when trying to write to a folder
- java IO to copy one File to another
- java read file from network device
- Sending the same but modifed object over ObjectOutputStream
- console.writeline and System.out.println
- Most efficient way to create InputStream from OutputStream
- read complete file without using loop in java
- Java Scanner doesn’t wait for user input [duplicate]
- Reading file chunk by chunk
- difference between flush and close function in case of filewriter in java
- Resetting Standard output Stream
- java file input with rewind()/reset() capability
- Will using longs instead of ints benefit in 64bit java