Impetus Interview Questions: Code Snipet 1

What will be the output of the code?


interface TestOne{
    int limit=100;
    void display();   
}

interface TestTwo{
    int limit=200;
    void display();   
}

public class TestInterface implements TestOne,TestTwo{
    //int limit=0;
    @Override
    public void display() {
        System.out.println("Hello... Test interface...."+limit);
       
    }
   
    public static void main(String [] arg){
        TestInterface obj=new TestInterface();
        obj.display();
     }


}
-------------------------------------------

Output: Compiler error at System.out.println(....) : The field "limit" is ambiguous.

Comments

Popular posts from this blog

Read Images from a xlsx file using Apache POI

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

How to create mail message in FRC822 format