How will you define an interface?

How will you define an interface?

The following syntax is used to define the interface :
 accessModifier interface InterfaceName{
   dataType var1;
   dataType var2;
   ..............
   ..............
   void method1();
   void method2();
   ..............
   ..............
   }

Here accessModifier may be default or public.
Interface may contain constant variables. These variables are implicitly public static final, you don\'t have to type it explicitly.
Interface can have only public abstract methods, you dont have to type public abstract modifiers explicitly.

By:Jalees
Date:2015-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher