The two advantages of modern operating systems is that it
has the capacity in helping programs to be loaded faster compared to other
older versions and it also has the ability of having to run programs that are
large enough in which is in the main memory even if it is smaller compared to
the size of its program.
Answer:
Following are the code to the given question:
int j,chocolateFlavorCount = 0;//declaring integer vvariable
for(j=0;j< flavorArray.length;j++)//defining a loop that starts from 1 to array length
{
if(flavorArray[i].contains("chocolate"))//use if that checks array contains string value that is chocolate
{
chocolateFlavorCount++;//incrementing integer variable value
}
}
System.out.println(chocolateFlavorCount);//printing integer variable
Explanation:
- In this question, an integer variable "chocolateFlavorCount, and j" is declared, in which j used in the for loop.
- The loop starts from 1 and stops when it is equal to the array length it also defines an if block that checks array contains string value that is chocolate.
- If the condition is true it will increment integer variable value and print its values.