Menu
Topics Index
...
`

Abstract Classes663


If you need explanation Read this topic

If you need Answer Take test on this topic

Abstract Classes663
Which of the following classes fail to compile?
abstract class X
{
    abstract void method();
    void method(int i){}
}

abstract class Y
{
    abstract void method();
    abstract void method1();
}

abstract class Z
{
    abstract void method1();
}

A. X
B. X, Z
C. Y, Z
D. X, Y, Z
E. All classes compile
Topic: Rules For Abstract Methods and Abstract Classes

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

answer is A.As X is an abstract class method(int i) should not be defined

Posted by Badam Swathi    2014-03-20 12:37:32


in class x it contains one abstract method declaration with no parameters and one concreate method with integer parameter therefore class is abstract ..in class y it contains two abstract method declarations so it can be abstract and class z contains one abstract method declaration so it is abstract therefore all  classes compile without any errors hence answer is e

Posted by Sangeetha Ptl    2014-03-20 12:40:17


Ans is E all classes compile An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.An abstract method is a method that is declared without an implementation

Posted by Naga Sinst    2014-03-20 12:40:59


all classes can compile abstract means declaration without definition so each abstract class is independent to each other

Posted by Adithya Aleti    2014-03-20 12:43:27


think answer is A:since in any abstract class methods can be defined and even can be declared but with no parameters so class X cannot be compiled

Posted by Shireesha Lanka    2014-03-20 12:48:26


Answer is A . In which method should not be defined.

Posted by Harish Kumar G    2014-03-20 15:18:48


Congratulations Sangeetha Ptl. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-03-21 04:15:27


© meritcampus 2019

All Rights Reserved.

Open In App