Looking for trustworthy answers? Westonci.ca is the ultimate Q&A platform where experts share their knowledge on various topics. Get immediate answers to your questions from a wide network of experienced professionals on our Q&A platform. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.
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 platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.