Can a abstract class be defined without any abstract methods?

Ads
 

Can a abstract class be defined without any abstract methods?

hi,

Can a abstract class be defined without any abstract methods?

thanks,

View Answers

April 15, 2013 at 10:26 AM

Hi friend,

Yes, we can create an abstract class without declaring any abstract methods.

Following code snippet shows how you can create an abstract class without any abstract methods.

public abstract class AbstractClass
{

    public String getName()
     {
            return "RoseIndia";
     }
}

public class Test extends AbstractClass
{

   public static void main(String args[])
    {
         Test test = new Test();
          String name = test.getName();
          System.out.println("\n"+name);
    }
}

April 15, 2013 at 11:28 AM

Hi,

Yes, you can create abstract class without any abstract methods. Doing so, there is no need to create an instance of the class and we can access its methods.

Ads









Related Tutorials/Questions & Answers:
Can a abstract class be defined without any abstract methods?
can we mark the class with abstract..with out having any mothed in tit as abstract!!! - Java Beginners
Advertisements
Can a abstract class be declared final?
Abstract Class in Java
Abstract class
abstract class
Abstract class
abstract class
Can you create an object of an abstract class?
Abstract class
abstract class
Can we instantiate abstract class in Java?
Java Abstract Class
Abstract class and abstract method
Abstract class
abstract class
Abstract class,Abstract methods and classes
Java Abstract Class Example
Java abstract class
Using Abstract Class
code for abstract class
variables and methods declared in abstract class is abstract or not
What is an abstract class?
Why Abstract Class?
Why Abstract Class?
Abstract class and interface in Java
Interface and Abstract class
Abstract class or methods example-1
Interface and Abstract class
Abstract class - Java Beginners
Interface vs abstract class

Ads