Menu
Topics Index
...
`

Rules for abstract methods and abstract classes2831


If you need explanation Read this topic

If you need Answer Take test on this topic

Rules for abstract methods and abstract classes2831
Which program(s) is/are valid?
Program 1:
abstract class A
{
    abstract void method1();

    abstract void method2() {}

}
Program 2:
abstract class A
{
    abstract void method1();

    void method2() {}

}

A. Program 1 is valid
B. Program 2 is valid
C. Both programs are valid
D. Both programs are invalid
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 B as in program 1 abstract method has a body which is not possible

Posted by Sai Avinash    2014-08-22 12:57:08


program 2 is valid...

Posted by Akshay Bansod    2014-08-22 13:02:11


B is the answer.An abstract method has no implementation code inside curly braces like normal methods do. So program 1 is not valid.

Posted by Varun Kumar    2014-08-22 13:04:24


b is the corct answer

Posted by Deepika Deepu    2014-08-22 13:25:27


No winner for this dose. Correct option is 'B' :(. Sai Avinash was already won in this week.

Posted by Merit Campus    2014-08-25 07:25:46


© meritcampus 2019

All Rights Reserved.

Open In App