mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-13 16:15:31 +08:00
Merge pull request #374 from GammaBurst101/Fix-error
Fix a logical error and set a method to private
This commit is contained in:
@ -18,8 +18,8 @@ import java.util.Scanner;
|
|||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int wordCount(String s){
|
private static int wordCount(String s){
|
||||||
if(s.isEmpty() || s == null) return -1;
|
if(s.isEmpty() || s == null) return 0;
|
||||||
return s.trim().split("[\\s]+").length;
|
return s.trim().split("[\\s]+").length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user