• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in JAVA by


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

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


Find the value of value[i]?

a) 10

b) 11

c) 15

d) None of the above

1 Answer

0 votes

(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 in JAVA by Robindeniel
0 votes
asked Apr 10 in JAVA by Robindeniel