Arrays and ArrayLists
File IO
Inheritance
Interfaces
Wild Card
100

How can you find the length of an array within a 2d array

array[index].length

100

This type of exception must be handled when doing file I/O.

FileIO Exception

100

How many classes can a class extend?

1

100

What keyword is required to use an interface within a class

implements

100

All Java classes implicitly inherit from this class if there is no specified parent

Object

200

This loop type is ideal when you want to iterate through all values in an array without modifying indices.

for each

200

This type of reader allows you to read raw bytes from a file

FileInputStream

200

A method in a subclass that has the same signature but different implementation is doing this.

Overriding

200

Writing actual code in a method within an interface requires this keyword

default

200

Fields marked with this access modifier are accessible to subclasses but not to other classes.

protected
300

How can you access elements of an ArrayList?

.get(index)

300
This java class has an efficient readline() method

BufferedReader

300

This type of method cannot be overwritten in any subclass

final

300

Variables declared in Java interfaces implicitly have these charactarisitics

public static final

300

This operator can be used to check if an object belongs to a certain class

instanceof

400

This method tells you if a certain value exists within an arraylist

.contains(value)

400

What can you use to read objects directly from files?

ObjectInputStream

400

Class A has protected method getNum(), class B extends A and has public method getNum(), is this allowed?

Yes - child classes can have more accessible methods, but less accessible methods are not allowed

400

Can interfaces implement other interfaces?

No (The can extend other interfaces)

400

Where do we put code that we want to always execute, and can't be bypassed by a return

The finally block
500

Use a loop to create a triagular array where array[0].length is 5, array[1].length is 4, and so on

int[][] triangle = new int[5][];

for (int i = 0; i < triangle.length; i++) {
  triangle[i] = new int[5 - i];
}

500

What happens when an ObjectInputStream tries to read past the end of a file

EOFException
500

If class B extends class A and you have an object that is of type A, how can you perform B's methods on that object?

casting


(B(objectA)).method()

500

If class B implements interface A, and class C extends class B, what is the relationship between C and A?

C implicitly implements A

500

class A {
    void show() { System.out.println("A"); }
}

class B extends A {
    void show() { System.out.println("B"); }
}

class Test {
    public static void main(String[] args) {
        A obj = new B();
        obj.show();
    }
}

B