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



I Have a class abstract with one abstract method, so that method should override in the subclass, ..

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

I Have a class abstract with one abstract method, so that method should override in the subclass, ..

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

Post New Answer

More Core Java Interview Questions

What are the new features in java 8? Explain

0 Answers  


What is temp in java?

0 Answers  


How would overload a function based on return type?

0 Answers   Genpact,


Does constructor creates the object ?

0 Answers  


Can main() method in java can return any data?

0 Answers  






How can I debug the Java security exceptions and AccessControlExceptions?

0 Answers   IBM,


What is scope & storage allocation of global and extern variables? Explain with an example

0 Answers   IBS,


Can constructor be inherited?

0 Answers  


What is an object's lock and which object's have locks in java programming?

0 Answers  


What is the difference between the ">>" and " >>>" operators in java?

0 Answers  


What is the mapping mechanism used by java to identify IDL language?

0 Answers  


please send me hr interview questions in it industry

0 Answers  


Categories