Given the following four Java file definitions: Which set modifications enable the code to
compile and run?
A.
At line n1, Insert: import facades.*;At line n2, insert:import facades;import
org.domain.Woofy;
B.
At line n1, Insert: import facades.Foo, Boo;At line n2, insert:import org.domain.Woofy;
C.
At line n1, Insert: import facades.*;At line n2, insert:import facades.Boo;import org.*;
D.
At line n1, Insert: import facades;At line n2, insert:import facades;import org.domain;
E.
At line n1, Insert: import facades.*;At line n2, insert:import facades;import org.*;
Answer: ?
line n1:
– import facades.Foo; //or facades.*;
– import facades.Boo;
line n2:
import facades.*;
import org.domain.Woofy;
Code question:
package facades;
public interface Foo {
}
package facades;
public interface Boo extends Foo { //interface Boo implements interface Foo??
}
package org.domain;
import facades.Foo; //or facades.*;
import facades.Boo;
public class Woofy implements Boo, Foo {
}
package org;
import facades.*;
import org.domain.Woofy;
public class Test {
public static void main(String[] args) {
Foo obj = new Woofy();
System.out.println(obj.getClass());
}
}
Output:
class org.domain.Woofy