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

Why is java called java?

815


Can an anonymous class be declared as implementing an interface and extending a class in java programming?

920


When is the finalize() called? What is the purpose of finalization?

846


Write code of any action class?

758


What is an 8 bit word?

827


Write code to implement bubble sort in java?

790


What is an inner class in java?

746


How to retrieve data from database in java using arraylist?

771


What are the basic concepts of OOPS in java?

787


Differece between class and generic class?

816


explain local datetime api in java8?

798


What is a variable declaration?

776


What is ‘has a’’ relationship in java?

972


Is there any way to find whether software installed in the system is registered by just providing the .exe file? I have tried the following code but its just displaying the directory structure in the registry. Here the code : package com.msi.intaller; import java.util.Iterator; import ca.beq.util.win32.registry.RegistryKey; import ca.beq.util.win32.registry.RootKey; public class RegistryFinder { public static void main(String... args) throws Exception { RegistryKey.initialize(RegistryFinder.class.getResource("jRe gistryKey.dll").getFile()); RegistryKey key = new RegistryKey(RootKey.HKLM, "Software\\ODBC"); for (Iterator subkeys = key.subkeys(); subkeys.hasNext();) { RegistryKey subkey = subkeys.next(); System.out.println(subkey.getName()); // You need to check here if there's anything which matches "Mozilla FireFox". } } }

1569


What is the difference between assignment and initialization?

826