Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

List the different categories of international employees. page 689

Answered: 1 week ago