Merge pull request #370 from GammaBurst101/change
Closed scanner and changed a method to private
This commit is contained in:
commit
81d3e9bf4a
@ -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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class CountChar {
|
|||||||
* @return int: Number of characters in the passed string
|
* @return int: Number of characters in the passed string
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public static int CountCharacters(String str) {
|
private static int CountCharacters(String str) {
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user