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 inbuilt functions?

752


What is the difference between heap and stack memory?

890


How can you write a loop indefinitely in java programming?

769


Explain about join() method?

742


What is the meaning of I ++ in java?

855


What is the constructor?

813


What is array in java?

751


What is the independent variable in an experiment?

747


How do I remove a character from a string in java?

719


How can you avoid serialization in child class if the base class is implementing the serializable interface?

841


What is string syntax?

814


What is slash r?

759


What is rule of accessibility in java?

766


How many inner classes can a class have?

808


Write a program to find the whether a number is an Armstrong number or not?

784