8.1-2_Inheriting Object Flashcards
1
Q
What is the only class that doesn’t have a parent class?
A
java.lang.Object
2
Q
What happens when you doesn’t extend a specific class?
A
The compiler automatically adds the syntax ‘extends java.lang.Object’ to the class definition.
public class Zoo { } public class Zoo extends java.lang.Object { }
3
Q
What implies that all classes inherit from java.lang.Object?
A
The result is that every class gains access to any accessible methods in the Object class.
4
Q
What about inheritance with primitives?
A
primitive types such as int and boolean do not inherit from Object, since they are not classes.
-> Instead use the Wrapper classes for that