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 do you understand by weak reference?

553


How do you join strings in java?

522


why doesn't java run on all platforms?

567


What is volatile data type?

549


Can a class be a super class and a sub-class at the same time? Give example.

798






What is multi-catch block in java?

616


What happens if we override private method?

523


What are untrusted applets?

587


How many bits is a char?

534


Define inheritance?

553


What is the basic of java?

571


Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain

1435


What is the difference between the size and capacity of a vector?

568


What is autoboxing in java?

607


What are different types of encoding?

579