Can i have abstract class with no abstract methods?
Answers were Sorted based on User's Feedback
Answer / m.ahmad
yes, you can create abstract class with out abstract
method. Otherwise you can create abstract methos in
abstract class must you can overwrite in extends class
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / brainindia
yes,abstract class contains non abstract methods and as well
as abstract methods also.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / priyank
Yes we can have an abstract class without abstract method
in c#.net.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Abstractdemo
{
abstract class A
{
public void Data()
{
Console.WriteLine("this is data");
}
}
class B : A
{
public void Data1()
{
Console.WriteLine("this is B");
}
}
class Program
{
static void Main(string[] args)
{
B b1 = new B();
b1.Data();
}
}
}
FYI
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / punit
Yes we can, try this example:
abstract class absDemo
{
void hello()
{
System.out.println("Hello abstract");
}
}
class ab extends absDemo
{
void hello1()
{
System.out.println("hello hello1");
}
}
class absDemo1
{
public static void main(String args[])
{
ab a=new ab();
a.hello1();
a.hello();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shraddha
yes abstract class can have zer or more abstract methods
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manoj
Yes, we can have a abstract class without a abstract method .
But in earlier version like jdk 1.1,it was necessary to have at least one abstract method inside abstract class then latter this restriction was removed by other versions.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / abhinav
yes we can have abstract classwithout abstract method only
if it has been inherited by another abstract class thats is
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / manish rawat
In abstract class we must declare atleast one abstract
method,because how can a class be abstract without an
abstract method(then what is the difference between
abstract and concrete class)
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sowju
yes we can have.Abstract class can have one or more abstract
and non abstract methods,but it must contain aleast one
abstract method.
| Is This Answer Correct ? | 6 Yes | 22 No |
What will be the default values of all the elements of an array defined as an instance variable?
What is the static method?
What is byte [] in java?
Why is sizeof not a function?
Hai all I want to print given array in reverse order Ex: int a[]={1,2,3,4,5};display this array in reverse order.
all are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined classes and we can extend atmost one class so each class can extend more than one class so java supports multiple inheritance?i am confused with this,pls any one explain me.
Which method cannot be overridden in java?
what is method reference in java 8?
What happens when a class is made static like if a field or member is made static it becomes class variable and is shared by all the object of the class?
Is there any difference between nested classes and inner classes?
What is the use of volatile in java?
What is difference between module and function?