Problem statement:
Given java code, what will be the output of it?
Given java code, what will be the output of it?
- interface Car {
 - public void startEngine();
 - }
 - class MySuzuki implements Car {
 - public void startEngine() {
 - System.out.println("MySuzuki");
 - }
 - }
 - class MyFerrari implements Car {
 - public void startEngine() {
 - System.out.println("MyFerrari");
 - }
 - }
 - public class OOPSExample {
 - public static void main(String[] args) {
 - Car obj = new MySuzuki();
 - obj.startEngine();
 - }
 - }
 
Output:
MySuzuki
No comments:
Post a Comment