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 {
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / shreya tanavade
if you dont want to override the abstract method i.e. SampleMethod ,then you must declare the subclass as ABSTRACT..i.e.declare....public declare class AbstractExampleImple ...otherwise it wuld throw compilation error
| Is This Answer Correct ? | 1 Yes | 0 No |
class A { class B { psvm(String args[]) { } } } if the prg saved in A.java whats the o/p?
What are the advantages of java?
Is linked list a linear or non-linear data structure?
0 Answers Akamai Technologies,
what is enumset?
Can a final variable be null?
How to compare two strings in java program?
What is enhanced loop in java?
What is immutable class in java?
What is the difference between throw and throws in java?
what is the need of the Ajax?
Hi am an mca graduate . i have done bsc maths in my degree . every company asks me why you make shift from maths group to computere field . What i need to answer?
What is the final class?