What is the result?

Given the code fragment:

What is the result?
A. 1:2:3:4:5:
B. 1:2:3:
C. Compilation fails.
D. An ArrayoutofBoundsException is thrown at runtime.

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “What is the result?

  1. reassign nums1
    public static void main(String[] args) {
    int nums1[]=new int [3];
    int nums2[]={1,2,3,4,5};
    nums1=nums2;
    for (int x :nums1){
    System.out.print(x+”:”);
    }
    }
    the result 1:2:3:4:5:

Leave a Reply

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


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