object oriented programming Flashcards

1
Q

class abstraction

A

the separation of class implementation from the use of the class

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

implementation

A

declaration of methods and attributes and code

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

class encapsulation

A

hide the details of class implementation from the user

hide the details, focus on whats important

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

class contract

A

pretty much what the API is. what methods and attributes are availible and what are their descriptions. user should only look at this, no further details

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

class inheritance usage

A

public class extends

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

public

A

class can be seen everywhere in java

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

protected

A

only package members and subclasses can see it

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

no modifier

A

only package members can see it, no subclasses

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

private

A

member can only be seen in its own class

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

polymorphism

A

variable of a superclass can refer to a subclass/more specialized class

area of 2dfigure can be circle or square

opposite of super()?

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

overloading

A

same method name can have different parameter list

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

overriding

A

subclass methods can override superclasses definitions. use @override modifier. so when you want to use polymorphism, this may be useful

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

concrete class

A

class can be used to create objects

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

abstract class

A

class CANNOT be used to create objects. they are allowed to have constructors that subclasses can use. concreate subclasses must implement all abstract methods or be abstract itself.

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

static

A

do not need an instance to be called. alot of core java functions/libraries are this

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

interface

A

class like construct that only has constants and abstract methods

  • cannot have constructors
  • all variables must be public, static, or final
  • all methods must be public abstract
  • interface can be used with extends keyword, and interface can extend multiple other interfaces
  • class can extend multiple interfaces
  • can be used as data type
17
Q

when to use interface

A

interfaces model pure behavior. ANSWER WHAT CLASS CAN DO.

abstracts can save duplicate code

remember that you implement multiple interfaces but only extend from one superclass