In this Java programming Tutorial I'll teach you how to write a program to count the number of characters, words and lines in a file.
Name of the file is taken as an input from the user using the scanner, if the user types the filename incorrect, the program will prompt for re-inputting the file name. The file is processed as line-based and token based by using various Scanner methods.
Following topics will be covered in this tutorial:
Java Scanner class, hasNextLine(), nextLine(), hasNext(), next(), line-based file processing, token-based file processing, private, public, methods, variables, PrintWriter, Exception Handling, File, canRead(), File Input and Output, String length(), while loop, for loop, Java OOP, System.out, System.in, print(), println().
Watch video Java - Counting number of Characters, Words and Lines using the Java Scanner online without registration, duration hours minute second in high quality. This video was added by user Android Master Academy 21 October 2017, don't forget to share it with your friends and acquaintances, it has been viewed on our site 10,19 once and liked it 4 people.