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
How does a for loop work?
How do you use equal in java?
What is string data type?
Difference between java and javascript
What are the states of thread in java?
Explain the differences between static and dynamic variables?
Describe string intern() methodology
what are different ways in which a thread can enter the waiting state? : Java thread
What is jdbc api?
How to perform selection sort in java?
Can a class be declared as protected?
Why are data types important?
Can we declare the static variables and methods in an abstract class?
Can we have 2 main methods in java class?
What are the steps in the jdbc connection?