Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (a) What are the local variables in the following method? public String binar

ID: 3918177 • Letter: 1

Question

1. (a) What are the local variables in the following method? public String binary (int decimal) ( String binary int base return binary; (b) Identify and explain what kind of casting the following snippet code is performing in the last two statements. class Instrument class Piano extends Instrument ( Instrument inst new Piano() 1 Piano p (Piano) inst; I1 (c) Write a for loop to print the content of the array. double []constants (3.14159, 2.7182, 1.67; (d) Assuming that, there is not a syntax error, what is the output of this code? int [Inum - (e, 1, 2, 3, 4, 5) for (int i-; i num.length; i+) if (num[i] % 2--0) System.out.println(num[i]); D)

Explanation / Answer

Ans:1

a:

local variables are:

string, base;

Ans 1c:

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

{

System.out.println(constants[i];

}

Ans:1c

downcasting

Ans:1 d

The given code snippet print the even numbers so output is..

0

2

4

========================================================

KIndly Check and Verify Thanks..!!!