*******************************************************************
COMPLETE SOURCE CODE FOR : OmitWhitespaceInString.java
*******************************************************************
public class OmitWhitespaceInString
{
public static void main(String[]args)
{
//Create a String with whitespace
String a=" Eliminate white space in t h i s s t r i ng ";
//Get String length that base on numbers of character include whitespace
int temp=a.length();
//Create an int variable
int numbersOfLetter=0;
//Create loop to count the numbers of Letter
for(int i=0; i<temp; i++)
{
if(Character.isLetter(a.charAt(i)))
{
numbersOfLetter++;
}
}
//Create an array base on numbers of letter that we get
char[]storeAllCharacter=new char[numbersOfLetter];
//Create an int variable
int temp3=0;
//Create loop to set each value in array
for(int i=0; i<temp; i++)
{
if(Character.isLetter(a.charAt(i)))
{
storeAllCharacter[temp3]=a.charAt(i);
temp3++;
}
}
//Get String from created char array
String resultStringAfterOmit=new String(storeAllCharacter);
//Print result
System.out.println(resultStringAfterOmit);
}
}
*******************************************************************
JUST COMPILE AND EXECUTE IT
*******************************************************************