Westonci.ca is the ultimate Q&A platform, offering detailed and reliable answers from a knowledgeable community. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
Sagot :
Answer:
public class CountSpaces
{
public static void main(String[] args)
{
String quote = "The concept of infinity is meaningless inside of an insane human mind.";
int nrSpaces = calculateSpaces(quote);
System.out.println("Nr spaces in your quote is " + nrSpaces);
}
public static int calculateSpaces(String inString)
{
int count = 0;
for (int i = 0; i < inString.length(); i++) {
if (inString.charAt(i) == ' ') {
count++;
}
}
return count;
}
}
Explanation:
In this example there is only one class, and since all methods are static the true concept of the class is not even being used.
Thank you for choosing our service. We're dedicated to providing the best answers for all your questions. Visit us again. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Thank you for visiting Westonci.ca. Stay informed by coming back for more detailed answers.