Exam Preparation Angela Flashcards

1
Q

Proper names of Classes State and Behaviour

A

Fields, and Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Creating an object from a class

A

Type name = new Constructor()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

During inheritance what does the subclass inherit from the superclass

A

Non private Fields and Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name 3 main errors and what they are

A

Syntax (compile time error), Runtime (java error thrown), and Logical (programmer error)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the two steps of Static typing

A

Declaration (Car c), Initalization (= new Car)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does marking something as final mean

A

No changes can be made after compilation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s special about Final lists

A

The internals can be changed (add, remove, etc) however a new list can not be made from a list declared final

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the format for the Ternary operator

A

Variable x = (boolean expression) ? resultIfTrue : resultIfFalse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Static Method use

A

result = math.ceil(parameters)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Local Method use

A

resultVar = name(parameters)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Object methods use

A

obj.name(parameters)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Requirements to overload a Method or Constructor

A

Type, order, and number of parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

T/F a(obj) == b.clone(obj)

A

True, objects yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

T/F a[] {…} == b.clone[] {…}

A

False, values like in no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Public visibility

A

All places can access public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Private visibility

A

Only the class can access public fields and methods

17
Q

Protected

A

Visible in everything but the outside world (not descendants)

18
Q

What do subclasses inherit

A

Non private methods and fields

19
Q

What is called implicitly when when extending a superclass constructor is a subclass

A

super(superclass values)

20
Q

How are polymorphism and compilers related

A

The compiler won’t check the type of a method call until runtime

21
Q

What are three features of Abstract classes

A

Classes extend then, they can not be instantiated, they are allowed to have instance variables

22
Q

What are Anonymous classes and what is their general formatting

A

Unnamed implicit classes

public void name() {
    AnonName n = new AnonName() {
        String name = "A string";
        public void anonMethod() {
            S.o.pln(name);
        }
    };
    n.greet();
}
23
Q

Name five common exceptions

A
NullPointer
ArrayIndexOutOfBounds
ClassCast
Interrupted
IO