Home / MCQ Bank / Computer
Computer Interfaces And Abstract Classes

What is the result of the following code snippet? interface MyInterface { void myMethod(); } public class MyClass implements MyInterface { public void myMethod() { System.out.println("Implementation"); } public static void main(String[] args) { MyInterface obj = new MyClass(); obj.myMethod(); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • Implementation

Related Computer Questions

Which of the following devices have a limitation that we can only store information to it but cannot erase or modify it? What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class A{ mutable int a; public: A(){ cout<<"Default constructor called\n"; } A(const A& a){ cout<<"Copy Constructor called\n"; } }; int main(int argc, char const *argv[]) { A obj; A a1 = obj; A a2(obj); } Which of the following is a disadvantage of replication? What is the default return type of a function? Why does the Node rely on event handlers?