Question: 16) Given an array called numArray that contains the following integer values: {5, 1, 8, 4, 6, 3, 7, 9} and the code: for (int

16)

Given an array called numArray that contains the following integer values:

{5, 1, 8, 4, 6, 3, 7, 9}

and the code: for (int index = 3; index if (numArray[index] > 4) System.out.print(numArray[index] + " "); }

What is output?

17) Given an input data file containing one line:

2 14 5 16

Assume that the file has already been opened for reading using a Scanner variable called fileInput. What will be output by the following code:

16) Given an array called numArray that contains the following integer values:

18)

Given:

double gpa = 3.7839;

Assume that an output file has just been opened for writing, using a PrintWriter variable called fileOutput.

Give one line of Java code that will write the value of gpa to the file, rounded to 1 decimal place, with no spaces before or after the value, and no newline afterwards.

19) Given that the method readSomething() may throw an IOException,

here is some code that calls the readSomething() method: int result; try { result = readSomething(); } // missing code to handle the exception

Supply the missing code to handle the exception by displaying any message passed back from the thrown exception, and setting result to 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!