• We can develop interfaces by using "interface" keyword. 
  • A class will implements all the methods in an interface.
  • By default interface methods are abstract.
  • Lets see some interesting java programming interview questions on interfaces.
  • Interface programming questions in java




Java interface interview programs part 1: interface programming java

Program #1: what will happen if we define normal methods in interface

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. void show() {
  9.         
  10.         System.out.println("Hello world");
  11.  
  12.     }
  13. }





Program #2:java interview programs to practice: Non static variables in interface

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. int a,b;

  9. }





Program #3:java interview programs to practice: which modifiers interface allows

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. private int x;
  9. protected int y;

  10. }





Program #4:java interview programs to practice: interface allows constructor?

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7. A(){
  8.  
  9. }

  10. }





Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu