Home » JAVA Programming » Methods » Question
  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    byte array0[] = { 71, 72, 73, 74, 75, 76 };
    byte array1[] = { 77, 78, 79, 80, 81, 82 };
    System.arraycopy(array0 , 1, array1, 3, 0);
    System.out.print(new String(array0) + " " + new String(array1));
    }
    }
    1. GHIJKL
    2. MNOPQR
    3. GHIJKL MNOPQR
    4. GHIJKLMNOPQR
    5. None of these
Correct Option: C

Since last parameter of System.arraycopy(array0, 1, array1, 3, 0) is 0 nothing is copied from array a to array b, hence b remains as it is.



Your comments will be displayed only after manual approval.