OCA Java SE 8 Mock Exam Review - OCA Mock Question 19








Question

Which of the following declares a method that takes a float and an integer returns an array of integers?

a.  public int[] someMethod(int i, float f) { 
      return new  int[5];
    } 
b.  public int[] someMethod(int i, float f) { 
      return new int[];
    } 

c.  public int[] someMethod(int i, float f) { 
       return new int[i];
    } 

d.  public int []someMethod(int i, float f) { 
       return new int[5];
    } 




Answer



A, C, and D

Note

B cannot return an array with no size.