Can a abstract class be defined without any abstract methods?

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.









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
Abstract Class in Java
Abstract class
abstract class
Can a abstract class be declared final?
Abstract class
abstract class
Abstract class
Java Abstract Class
abstract class
Abstract class and abstract method
Abstract class
Can you create an object of an abstract class?
abstract class
Can we instantiate abstract class in Java?
Abstract class,Abstract methods and classes
Java abstract class
Using Abstract Class
Java Abstract Class Example
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 - Java Beginners
Interface and Abstract class
abstract class - Java Beginners
Interface vs abstract class
Abstract class or methods example-1
abstract class and interface - Java Beginners
Write Full concept of abstract class
An Abstract class may or may not have abstract method.
Abstract class and Interface - Java Magazine
Explain final class, abstract class and super class.
Interface Vs Abstract Class
what's the purpose of constructor in abstract class?
What is an Abstract Class and what is it's purpose?
Java-Abstract Class - Java Beginners
Abstract class or methods example-2
abstract class and overriding - Java Beginners
abstract class - Java Interview Questions
Difference between abstract class and an interface
abstract method
The abstract Keyword : Java Glossary
How to Declare Abstract Class in PHP ?
Abstract class or methods example-3
overriding in derived class from abstract class

Ads