Given:
And given the code fragment:
What is the result?
A. 4W 100 Auto
4W 150 Manual
B. Null 0 Auto
4W 150 Manual
C. Compilation fails only at line n1
D. Compilation fails only at line n2
E. Compilation fails at both line n1 and line n2
Given:
And given the code fragment:
What is the result?
A. 4W 100 Auto
4W 150 Manual
B. Null 0 Auto
4W 150 Manual
C. Compilation fails only at line n1
D. Compilation fails only at line n2
E. Compilation fails at both line n1 and line n2
E
E :
javac Car.java
Car.java:14: error: constructor Vehicle in class Vehicle cannot be applied to gi ven types;
Car (String trans) {
^
required: String,int
found: no arguments
reason: actual and formal argument lists differ in length
Car.java:19: error: call to this must be first statement in constructor
this (trans);
^
2 errors
correct answer is because
at n1 it didnt invoked parameterized constructor
at n2 both this() and super() is called which is incorrect
Correct answer is E.
Answer is E
Answer is D
Answer is A