Abstraction
- Which of these is not a correct statement?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Abstract class cannot be directly initiated with new operator, Since abstract class does not contain any definition of implementation it is not possible to create an abstract object.
- If a class inheriting an abstract class does not define all of its function then it will be known as?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Any subclass of an abstract class must either implement all of the abstract method in the superclass or be itself declared abstract.
- Which of these is not abstract?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Thread
- Which of these keywords are used to define an abstract class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
abstract
- What is the output of this program?
abstract class n
{
int K;
abstract void display();
}
class m extends n
{
int L;
void display()
{
System.out.println(L);
}
}
public class Abstract_class_Example
{
public static void main(String args[])
{
m obj = new m();
obj.L=5;
obj.display();
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
class n is an abstract class, it contains a abstract function display(), the full implementation of display() method is given in its subclass m, Both the display functions are the same. Prototype of display() is defined in class n and its implementation is given in class m.
output: 5