Hi
I try to make an abstract class and this class not contains any abstract method.it possible or not ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Feb 8, 2012, 12:59 AM
Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. An abstract class can contain no abstract methods also i.e. abstract class may contain concrete methods. A Java Interface can contain only method declarations and public static final constants and doesn't contain their implementation. The classes which implement the Interface must provide the method definition for all the methods present
Yes it is possible if all methods contain full implementation inside abstract class even though that class can be declare has a abstract class no need to keep at least one unimplemented method in side this class.
Ex:-
abstract class Allmethodsareimplemented
{
void test()
{
s.o.p("test from abstrct");
}
void test1()
{
s.o.p("test-1 from abstract");
}
void test2()
{
s.o.p("test-2 from abstract");
}
}
public class Manager
{
public static void main(String args[])
{
S.o.p("yes it is possible to keep even if all methods are contained implementation inside abstract then that class called as a abstract one ");
}
}
Note :- Abstract class contains both Abstract and Concrete methods.
Thanks