0 votes
in JAVA by

Given,

int values[ ] = {1,2,3,4,5,6,7,8,9,10};  

for(int i=0;i< Y; ++i)  

System.out.println(values[i]);  

Find the value of value[i]?

a) 10

b) 11

c) 15

d) None of the above

1 Answer

0 votes
by

(d) None of the above

Reason: In the above code, we have not defined the variable Y. The code will not execute without any specific value for Y; it results in exception, as shown below.

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
        Y cannot be resolved to a variable

So, the values of i will not be printed, and the above exception is thrown.

Related questions

0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
0 votes
asked Apr 10, 2021 in JAVA by Robindeniel
...