1. What will be the Output of the following code? class X{ static int x = 1; static class Y { static int y = x++; static class Z { static int z = ++y; } } } class MainClass{ public static void main(String[] rk) { System.out.print(X.x); System.out.print(X.Y.y); System.out.print(X.Y.Z.z); } } A. 113 B. 123 C. 111 D. None of These Ans: A 2. Which of the following statement is TRUE about t he following code? public class Outer { private i
Create two interfaces OLA and UBER both having a method public static Cab getCab() which returns the Cab object where Cab is a nested class inside OLA and UBER. Cab must have attributes cab_number and driver_name. A user rides 5 times using cabs of OLA and UBER randomly which are stored in an array. Now implement a method which should display the name of the driver and the company name i.e. OLA/UBER when the valid cab_number is entered by the user. Display "Invalid CAB details" when the cab_number entered by the user is incorrect.