8.2-1_Creating Classes Flashcards
How to specify a class is a subclass from another class?
By using the extends keyword …
class {ChildClassName} extends {ParentClassName} {
…
}
What is a top-level class?
It’s a class that is not defined inside another class.
What is an inner class?
It’s a class defined inside of another class.
Can we apply access modifiers to Class definitions?
Yes, But there are some distinctions for Top-level & Inner classes
What are the access-modifiers allowed for a Top-level class?
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)
What are the access-modifiers allowed for an Inner class?
Inner-level classes: In addition to public and package-private access, can also have protected and private access.