Interfaces 1
Interfaces 2
Array
ArrayList
100

Can a class implement more than one interface?

Yes.

100

Can interfaces have constructors?

No.

100

How do you find the length of an array?

varName.length

100

How do you find the length of an arraylist?

varName.size()

100

interface A

{

    private int add(int a, int b);

}

Is anything wrong in the above code? If so, what?

Methods have to be public in an interface.

100

interface MyInterface

{

    void myMethod();
}

class MyClass implements MyInterface

{

    public void myMethod()

   {

        return ;

   }

    public static void main(String[] args)

    {

          MyInterface sample = new MyClass();

    }

}

Is anything wrong in the above code? If so, what?

It is right.

100

How do you create an integer array with 5 elements and variable name "nums"?

int[] nums = new int[5];

100

How do you create an arraylist of integers with variable name "nums"?

ArrayList<Integer> nums = new ArrayList<Integer>();

100

All members of interface are public by default. True or false?

True

100

interface MyInterface

{

     void myMethod();
}

MyInterface sample = new MyInterface();

Is anything wrong in the above code? If so, what?

Cannot create instances of interface type. Only of classes that implement the interface.

100

How do you create a 2d array of integers with 3 rows and 4 columns and variable name "nums"?

int[][] nums = new int[3][4];

100

How do you add the number '5' to an ArrayList "nums"?

nums.add(5);

100

How do you access the integer at second row and third column of the 2d integer array "nums"?

nums[1][2]

100

How do you access the 5th index value of an ArrayList of integers "nums"?

nums.get(5);

M
e
n
u