ProgrammingEasyWipro · Capgemini pattern
In Java, which keyword makes one class inherit from another class?
- A. inherits
- B. extends
- C. implements
- D. super
Correct answer: B. extends
class B extends A makes B a subclass of A. implements is used for interfaces; super refers to the parent inside the subclass.
More OOP with C++ and Java questions
- What is the return type of a C++ constructor?
- Every Java class that declares no superclass implicitly extends:
- In C++, members of a class declared without any access specifier are:
- Which statement about Java String objects is correct?
- What is printed? java String s = "ab"; s.concat("cd"); s.toUpperCase(); System.out.print(s);
- Which pairing is correct?