Menu

Use Java Programming Following Questions Solutions Ready Within Today Jan 3 2020 8 00pm Gm Q43785320

Use java programming for the following questions to have thesolutions ready within today Jan 3 2020 at or before 8:00PM GMT+8time zone:

Question 5

A method secret() of a class F is shown below:

public intsecret(String[] stringArray, int n) { int num = 0;

for (int i=0; i<stringArray.length;i++)

if (stringArray[i].indexOf(“a”, n)>= 0)

num++;

return num;

}

A program segment using the method is:

F f = new F();

String[] array01 ={“an”, “easy”, “exam”, “on”, “Java”};System.out.println(f.secret(array01, 2)); array01 = newString[0];

System.out.println(f.secret(array01,3));

  1. Write down the output when the above segment is executed.
  1. Explain, in a paragraph, what is the purpose of the methodsecret().

Expert Answer


Answer to Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 8:00PM…

OR