public class solution {
    public static void main(String[] args) {
        String str = "The horse jumped over the sheep";
        String str1 = "";
        for(int i = 0; i!='\0'; i++); {
            if(str.charAt(i) != ' ')
                str1=str1+str.charAt(i);
        }
        System.out.println(str1);
    }
}
The program shows error at variable i. Is there any other means to print without white spaces without any in-built function?
 
     
     
    