Question 4
Consider the code given below.
interface Vehicle { public abstract int getMileage();}
class Car implements Vehicle, Cloneable { int mileage; public Car(int m) { mileage = m; } public int getMileage() { return mileage; } public Car clone() throws CloneNotSupportedException { return (Car) super.clone(); }}
public class Test { public static void main(String[] args) { Car car1 = new Car(25); try { Car car2 = car1.clone(); car1.mileage = 30; System.out.print(car1.getMileage() + car2.getMileage()); } catch (CloneNotSupportedException e) { System.out.println("Cloning not supported"); } }}What will the output be?