Menu
Question Index
...

What will be the output of the following program?

interface Pet
{
    public void test();
}
class Animal implements Pet
{
    public void test()
    {
        System.out.println("Interface Method Implemented");
        System.out.println("rest of the code");
    }
    public static void main(String args[])
    {
        Pet p = new Animal();
        p.test();
    }
}


Interface Method Implemented
Interface Method Implemented
Interface Method Implemented
Interface Method Implemented
rest of the code
Compilation Error or Runtime Error

Doubts

Problems

Topic: Future Task Java Program Using Interfaces

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App