I am suppose to use methods in order to count number of words in the a sentence. I wrote this code and I am not quite sure why it doesn\'t work. No matter what I write, I on
Use this method to calculate the number of words in a String:-
private int calculateWords(String s){ int count=0; if(s.charAt(0)!=' ' || s.charAt(0)!=','){ count++; } for(int i=1;i