InterviewSolution
Saved Bookmarks
| 1. |
Is The Below Program Written Correctly? If Yes, What Will Be The Output? Interface X { Void Methodx(); Interface Y { Void Method(); } } Class Z Implements X, X.y { { Method(); System.out.println(1); } Public Void Methodx() { Methody(); System.out.println(2); } Public Void Methody() { System.out.println(3); } } Public Class Mainclass { Public Static Void Main(string[] Args) { Z Z = New Z(); Z.methodx(); Z.methody(); X X = Z; X.methodx(); } } |
|
Answer» Yes, program is CORRECT. Output will be, 3 2 3 3 Yes, program is correct. Output will be, 3 2 1 3 2 3 3 |
|