Question: 1. Below is our first Java program of the semester. Next to each line, write out what you think the code will do when run.
1. Below is our first Java program of the semester. Next to each line, write out what you think the code will do when run. This exercise is adapted from Head First Java. (6 pts) 1 int size 27: Sizeis mtegaor and 2 2 String name "Fido" 3 Dog myDog -new Dog (name, size); int x size-5; 3 myDog. bark (8); 8 9 while (x3) while tye e lup 10 myDog.play) 12 13 14 int[] numList = {2, 4, 6, 8); 15 System.out.print ("Hello*; 16 System.out.println("Dog: name); 17 18 System.out.println(numList[l) t put 19 if (numList [3]=8) { 20 21 ) System.out.println("potato) 2. This is a function (a.k.a. method). It takes an array of integers and an integer as arguments, and returns an integer.Describe in English what mystery returns if inputArray 3, 0, 4, 6, 31 and k -2 6 pts] 1 public static int mystery(intl) inputArray, int k) ( int xinputArray[k]: int answer k; 4 int index 1; 5 white (index
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
