op Flashcards
(69 cards)
Which of these is correct way of inheriting class A by class B?
class B extends A {}
In java, __________ keyword is used to derive from another class
extends
Which class cannot create its instance?
Abstract class
Which of these method of ArrayList class is used to obtain present size of an object?
size()
How many interfaces can a class implement?
As many as needed
What does an interface contain?
Method declaration
All the variables of class should be ideally declared as?
private
How can the concept of encapsulation be achieved in the program?
By using the Access specifiers
______________ is similar to a method but it is called implicitly by the new operator to initialize an object’s instance variables when the object is created
Constructor
You can extend the class and create a totally new class that retains all the necessary properties and methods of the parent class from which it has been derived, and then expose new features.
.
Extensibility
__________ inheritance is achieved using interface in java
Multiple
Which concept of Java is achieved by combining methods and attribute into a class?
Encapsulation
Which among the following is correct?
class student{ public: student(){} };
Method overriding is combination of inheritance and polymorphism?
true
Which of the following is NOT an OOPS concept in Java?
Compilation
All classes inherit the cosmic superclass
T
true
Getters and setters are ___________ methods which are used if there is a need to provide an indirect access to private fields.
public
What is a superclass?
a class that acts as a parent to some other class or classes
It is possible to override private or static methods in Java
False
Which of the following statements are incorrect?
private members of class can be inherited by a subclass, and become protected members in subclass
Polymorphism in Java is of two types, namely ______ and __________
Run time, Compile time
Which feature of OOP indicates code reusability?
Inheritance
Which of these class relies upon its subclasses for complete implementation of its methods?
abstract class
All classes defined without an explicit extends clause automatically extend ___________
Object