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: