*********************************************************
COMPLETE SOURCE CODE FOR : CountAllWhitespaceInString.java
*********************************************************
import java.util.Scanner;
public class CountAllWhitespaceInString
{
public static void main(String[]args)
{
boolean a=true;
Scanner sc=new Scanner(System.in);
while(a)
{
System.out.println("Type EXIT to exit");
String b=sc.nextLine();
int whitespaceNumber=0;
if(!b.equalsIgnoreCase("exit"))
{
try
{
for(int i=0;i<=b.length()-1;i++)
{
char temp=b.charAt(i);
if(temp==' ')
{
whitespaceNumber++;
}
}
System.out.println("Whitespace number is : "+whitespaceNumber);
}
catch(Exception exception)
{
System.out.println("DON'T DO THAT");
}
}
else
{
a=false;
}
}
}
}
*********************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************