Close the scanner

This commit is contained in:
Prasoon 2018-01-24 21:27:30 +05:30
parent 555b715444
commit 652d227982

View File

@ -14,7 +14,7 @@ public class CountChar {
Scanner input = new Scanner(System.in); Scanner input = new Scanner(System.in);
System.out.print("Enter your text: "); System.out.print("Enter your text: ");
String str = input.nextLine(); String str = input.nextLine();
input.close();
System.out.println("There are " + CountCharacters(str) + " characters."); System.out.println("There are " + CountCharacters(str) + " characters.");
} }