Question: Given the following Java code: class Dog { } class…
en Normal / Single choice / 100% / 0% / 0%
Given the following Java code:
class Dog { }
class Spaniel extends Dog { }
class DogTest {
public static void main(String [] args) {
Dog d1 = new Dog();
Spaniel h1 = new Spaniel();
Dog d2 = h1;
Spaniel h2 = (Spaniel) d2;
Spaniel h3 = (Spaniel) d1;
}
}
What happens when we compile and run this code?
Question of the minute