8.2-1_Creating Classes Flashcards

1
Q

How to specify a class is a subclass from another class?

A

By using the extends keyword …
class {ChildClassName} extends {ParentClassName} {

}

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

What is a top-level class?

A

It’s a class that is not defined inside another class.

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

What is an inner class?

A

It’s a class defined inside of another class.

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

Can we apply access modifiers to Class definitions?

A

Yes, But there are some distinctions for Top-level & Inner classes

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

What are the access-modifiers allowed for a Top-level class?

A

Top-level classes can only have public or default (package-private) access.

  • > public access to a class indicates that it can be referenced and used in any class.
  • > default (package-private) access, indicates the class can be accessed only by a class within the same package. (The lack of any access modifier)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the access-modifiers allowed for an Inner class?

A

Inner-level classes: In addition to public and package-private access, can also have protected and private access.

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