Skip to content

Commit 4e6a859

Browse files
authored
Merge pull request TheAlgorithms#374 from GammaBurst101/Fix-error
Fix a logical error and set a method to private
2 parents 81d3e9b + f1200c0 commit 4e6a859

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Others/countwords.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public static void main(String[] args){
1818
input.close();
1919
}
2020

21-
public static int wordCount(String s){
22-
if(s.isEmpty() || s == null) return -1;
21+
private static int wordCount(String s){
22+
if(s.isEmpty() || s == null) return 0;
2323
return s.trim().split("[\\s]+").length;
2424
}
2525

0 commit comments

Comments
 (0)