What is the result?

Given: And given the code fragment: What is the result?

Given: And given the code fragment: What is the result?

A.
Compilation fails only at line n2

B.
Compilation fails at both line n1 and line n2

C.
Compilation fails only at line n1

D.
Null 0 Auto 4W 150 Manual

E.
4W 100 Auto 4W 150 Manual



Leave a Reply 11

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


Narayan

Narayan

Answer is A because, this(trans) will call constructor, that should be first statement in the constructor

Kazuyuki Arai

Kazuyuki Arai

B
n1 = Implicit super constructor is undefined. (Must call “super(type, maxSpeed);”)
n2 = Constructor call must be first statement in constructor.

Javier Miranda

Javier Miranda

La puta, estas respuestas estan mal, la respuesta es B, debido a que si se usa super o this, estos deben de ser llamados siempre en la primera linea del constructor

bella

bella

Yes Kazuyuki, I get the same errors as you did in Eclipse. However TestKing says the answer is:

Null 0 Auto
4W 150 Manual

Which is wrong.

TwinForce

TwinForce

I put it in Eclipse…
It fails at //line 1 & //line 2

Error //line 1:
Super(….) is undefined. The super(….) has to be the first argument in an construkter of an subclass.

Error //line 2:
Constructor call must be first statement in an constructor.
This is not possible because the argument super(…) has to be the first argument too.

Correct is “B”

Birendra

Birendra

Correct Answer is C. I have tried it in Eclipse.

AhmedAlkaff

AhmedAlkaff

The correct answer is
B.Compilation fails at both line n1 and line n2

Compilation fails at both
line n1:There is not default constructor in class Vehicle
line n2:Call of the constructor must be the first statement.

Laika

Laika

Sir are any of these question seen on the exam?