abstract class A
{
    abstract void callme();
    void callmetoo()
    {
        System.out.println("this is concrete method");
    }
}
class B extends A
{
   void callme()
    {
        System.out.println("implementation of callme");
    }

}
public class abstractdemo {
     public static void main(String []args)
     {
         B b=new B();
         b.callme();
         b.callmetoo();
     }

}

please help me out i m beginner in JAVA...

They're a tool to allow giving a class you define a type.

They're a tool to allow giving a class you define a type.

yeah sure they are tool

but we can do all those things w/o using abstrat class also

isn't it...?

Yes, there are many ways to do things. Some better than others

can u please explain it

i mean interface can also do same thing (exactly)

so whats the difference b/w interface and abstract classes??

No an interface doesn't contain code. An abstract class can have real methods that do something.

i understand that
but is there any difference b/w them??

See my last post.

okk..
the methods inside abstract classes are called "concrete methods"
isnt it

well why are they named so???

I think you'll get better answers if you find a good tutorial to read.

Well, here's a quick answer for the difference b/w abstract classes and interfaces :

Abstract classes can contain both abstract as well as non-abstract(concrete) methods.

Interfaces can only contain abstract methods. NO non-abstract (concrete) methods are allowed inside an interface. In other words, interfaces are 100% abstract classes.

Hope this helps as a starter, for the main course, off course you need a tutor or at least a good book. For the latter you can consult "head first JAVA" by Kathy Sierra and Bert Bates. Its an excellent book to learn java.

Good luck and happy learning :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.