Q.- Given the code fragment:-
and Test.java:-
class Test {
public static void main(String[] args) {
Employee e1 = new Employee();
Employee e2 = new Employee ("Jack", 50);
Employee e3 = new Employee ("Chloe", 40, 5000);
e1.printDetails();
e2.printDetails();
e3.printDetails();
}
}
What is the result?
A) Compilation fails in the Employee class.
B) Both the Employee class and the Test class fail to compile.
C) Compilation fails in the Test class.
D) null : 0 : 0
Jack : 50 : 2000
Chloe : 40 : 5000
E) null : 0 : 0
Jack : 50 : 0
Chloe : 40 : 5000
⧪ please give your answer in a comment section.
and Test.java:-
class Test {
public static void main(String[] args) {
Employee e1 = new Employee();
Employee e2 = new Employee ("Jack", 50);
Employee e3 = new Employee ("Chloe", 40, 5000);
e1.printDetails();
e2.printDetails();
e3.printDetails();
}
}
What is the result?
A) Compilation fails in the Employee class.
B) Both the Employee class and the Test class fail to compile.
C) Compilation fails in the Test class.
D) null : 0 : 0
Jack : 50 : 2000
Chloe : 40 : 5000
E) null : 0 : 0
Jack : 50 : 0
Chloe : 40 : 5000
⧪ please give your answer in a comment section.
4 Comments
Option B
ReplyDeleteB
ReplyDeleteb
ReplyDeleteB
ReplyDelete