What is the result?

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

Download Printable PDF. VALID exam to help you PASS.

7 thoughts on “What is the result?

  1. 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

  2. correct answer is because
    at n1 it didnt invoked parameterized constructor
    at n2 both this() and super() is called which is incorrect

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.