Concrete class vs. Abstract class vs. Interface in Java

Concrete class vs. Abstract class vs. Interface.

1. A concrete class has concrete methods, i.e., with code and other functionality. This class a may extend an abstract class or implements an interface.

2. An abstract class must contain at least one abstract method with zero or more concrete methods

3. An interface must contain only method signatures and static members.

4. An interface does not have definitions of the methods declared in it.

5. An abstract class may have some definition and at least one abstract method.

6. A subclass of an abstract class must either implement all the abstract methods of the abstract class or declare itself as abstract.
public abstract class A
{
   public abstract void methodA();
   public abstract void methodB();
}
class SubA extends A
{
   void methodA()
   {
       // implementation
   }
   void methodB()
   {
       // implementation
   }
}
interface interfaceA
{
   void methodA(int x);
}
class classA implements interfaceA
{
   // implementation for methodA and the rest of the class code if any.
}
How do I design a class so that it supports cloning in Java?
Deep cloning builds a new reference and a new object to refer to a new object...
Explain the complete syntax for using the Applet tag.
The Applet tag has the following attributes...
Where should we put applet class files, and how to indicate their location using the Applet tag?
An applet class file may present in any of the folder. The .class file name along with its current path...
Post your comment