Given the code
fragment:
public class Employee {
String name;
transient String companyName;
}
import java.io.Serializable;
public class Manager extends Employee implements Serializable {
String mgrId;
public static void main(String s[]) throws Exception {
Manager mgr = new
Manager();
}
}
What is the result?
A.
M001, ,
M001, ,
B.
M001, null, null
M001, null, null
C.
M001, Sam,
M001, Sam,
D.
M001, Sam, null
M001, Sam, null
E.
M001, Sam, ABC Inc
M001, Sam, ABC Inc
F.
Compilation fails
Compilation fails
G.
A NullPointerException is thrown at Runtime
A NullPointerException is thrown at Runtime
La risposta non c'è perché la domanda è probabilmente
incompleta.
May be Compilation fails if the two class are writed so appear there, if you copy and paste the text in a IDE there are problems with the second importation.
RispondiEliminabut if the class are copy in separated files compile but is not output