Can i have abstract class with no abstract methods?

Answer Posted / sitaram

yes,please find the below example.

abstract class AbstractClass1 {
public void method1(){
System.out.println("inside method1...");
}
}
class AbstractClass2 extends AbstractClass1{
public void method2(){
System.out.println("inside method2...");
}
}
public class AbstractDemo {
public static void main(String[] args) {
AbstractClass2 a = new AbstractClass2();
a.method1();
a.method2();
}
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the disadvantages of indexes in oracle?

1857


Explain about transient variables in java?

634


What is the difference in between cpp and java? Can u explain in detail?

598


What is string data?

547


What state does a thread enter when it terminates its processing in java programming?

570






Explain an intermediate language?

503


How do you override a variable in java?

522


can used Protected Class outside Function.?

605


Does list allow duplicates in java?

512


What is a hashmap used for?

640


what is encapsulation in java? Explain

657


What is the purpose of the main method?

537


Are there structures in java?

550


What is keyset in java?

647


What is the map interface in java programming?

581