Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void countChar() {
- try {
- x = new Scanner(new File(fileName));
- while(x.hasNext()) {
- s = x.nextLine();
- for(int i = 0; i < s.length(); i++) {
- charCount++;
- }
- }
- System.out.println("I counted " + charCount + " characters.");
- }
- catch(Exception e) {
- //blah blah
- }
- }
Add Comment
Please, Sign In to add comment