What is the result?


What is the result?
A. 10 20 30 40
B. 0 0 30 40
C. Compilation fails.
D. An exception is thrown at runtime

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “What is the result?

  1. Answer B:

    Because the second “numbers” reference variable is pointing to a new int array, while the initial int array got garbage collected. And since the new numbers array consists of 4 elements, the program assigns two values for the third and fourth elements, leaving the first and the second to the default assignment (i.e. zeros). Therefore, we will get 0 0 30 40.


Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.