I Have a class abstract with one abstract method, so that
method should override in the subclass, but i dont want to
override, if i am not override what will happen? If
compilation will occur then i dont want to give compilation
error, then what we need to do???
See the sample program.
public abstract class AbstractExample {
public abstract void sampleMethod();
}
public class AbstractExampleImple extends AbstractExample {

}

Answer Posted / kvsravindrareddy

Normally abstract method should implement in the subclass,
otherwise application will give compilation error. If you want
to without compilation error, then subclass also make as a
abstract class, application will not give any compilation
error.
See the below sample code.

public abstract class AbstractExample {
public abstract void sampleMethod();
}
public abstract class AbstractExampleImple extends
AbstractExample {

}

Is This Answer Correct ?    20 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of collections in java?

530


What about member inner classes?

631


What is an off by one error in java?

502


How to check if a list is sorted in java?

590


what do you mean by classloader?

555






What is t type java?

628


What does pointer mean?

546


What value is a variable of the string type automatically initialized?

613


What is fail first in java?

571


Difference between abstract and concrete class ?

583


Is java a super set of javascript?

587


Can we synchronize static methods in java?

600


Are variables stored in ram?

553


Is static a singleton?

527


What is autoboxing and unboxing?

584