Java Inheritance Flashcard

Flashcard
•
Computers
•
11th Grade
•
Easy
Mouna Boutemine
Used 11+ times
FREE Resource
Student preview

10 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What keyword is used to inherit a class in Java?
Back
extends
2.
FLASHCARD QUESTION
Front
What is true about the superclass and subclass relationship in Java?
Back
A subclass cannot access the private members of its superclass.
3.
FLASHCARD QUESTION
Front
What is method overriding in Java?
Back
Providing a specific implementation of a method that is already provided by its superclass.
4.
FLASHCARD QUESTION
Front
Correct way to call a superclass method from a subclass in Java: super.methodName();, this.methodName();, superclass.methodName();, methodName();
Back
super.methodName();
5.
FLASHCARD QUESTION
Front
In Java, which keyword is used to refer to the parent class of a class?
Back
super
6.
FLASHCARD QUESTION
Front
Which of the following statements is true about constructors and inheritance in Java?
- A subclass inherits all the constructors of its superclass.
- A subclass must override all the constructors of its superclass.
- Constructors are not inherited.
- Only parameterless constructors are inherited.
Back
Constructors are not inherited.
7.
FLASHCARD QUESTION
Front
What is the output of the following code snippet if `class B extends A` and both classes have a method `display()` that prints "A" in class A and "B" in class B, and method `display()` of class B calls `super.display()`?
```java
B obj = new B();
obj.display();
```
Back
AB
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Compression

Flashcard
•
KG - 12th Grade
9 questions
Average Items

Flashcard
•
12th Grade
9 questions
Java Intro-1

Flashcard
•
University
7 questions
Minecraft

Flashcard
•
KG
6 questions
Java Class and Object Concepts

Flashcard
•
12th Grade
10 questions
Java Exception Handling

Flashcard
•
11th - 12th Grade
9 questions
Java Methods

Flashcard
•
12th Grade
10 questions
Output in Java

Flashcard
•
11th Grade
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade