Program In Java To Accept A String And Find The Number Of Blank Spaces In The String?

1

1 Answers

Anonymous Profile
Anonymous answered
import java.io.*;
public class count
{
public static void main(String[]args)
{
String str = "this is my computer";
int count = 0;
int limit = str.length();
for(int I = 0; I < limit; I++)
{   
if(Character.isWhitespace(str.charAt(I))   
{       
++count;   
}
}

Answer Question

Anonymous