Lecture 7 Flashcards

1
Q

Access Modifier

The restriction to access the class members that are the 1.——- or 2.——-.

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

public (+) - class, package, subclass, world
protected (#) - class, package, subclass
default () - class, package
private (-) - class

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

be accessed from == > any class
Whenever you declare attribute in public, any class can access that attribute even they are in the same package, different package and the outside.

A

Public (+)

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

be accessed from ==> the same class
==> class in the same package
==> sub-class in the same package.
==> sub-class in the differenct package.

A

protected (#)

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

be accessed from ==> the same class
==> class in the same package
==> sub-class in the same package

A

default()

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

be accessed from ==> the same class only

A

private (-)

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

1.——– is a set of instructions that allows a class or objects to perform a task.

A
  1. Method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. What are the THREE types of methods?
A
  1. Main method
  2. Constructor
  3. Class method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

1.——– is protect direct access to class variable, Data hiding, Maintainability and Controllable.

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

2.——- is Resuability, Extensibility, reuse the super class and IS-A relationship.

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

3.——– is having multiple forms, Flexibility and having overloading method.

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

What is the OOP Concept?

A

E-I-P
-Encapsulation
-Inheritance
-Polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  • private attribute
  • public getter and setter
A

E (Encapsulation)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  • extends -> class
  • implements -> interface
A

I (Inheritance)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • subclass -> super class
A

P (Polymorphism)

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

what hides the implementation details of a class?

A

Encapsulation

17
Q

Multiple forms of method (function) in the same class is called?

A

Overloading method

18
Q
  • Same method name but different number of parameters.
  • When the number of parameters is the same, parameters must be different data types

Special - use parameter list to indicate which method must be used.

A

Overloading method

19
Q

Type 1
String print(String str, int var){}
String print(String str){}

Type 2
void print(String str){}
void print(int var){}
void print(double var){}

A

overloading method

20
Q

overloading can be used in Constructor
* public Car(){}
* public Car(String brand){}
* public Car(String brand, double price){}

A

use parameter list to indicate which method must be used