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.

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Create Nested table inside a table on a pdf document using iText