Java OCA OCP Practice Question 2740

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];}


a, c, and d

Note

Option b fails to initialize the array properly.




PreviousNext

Related