exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 53 discussion

Actual exam question from Oracle's 1z0-808
Question #: 53
Topic #: 1
[All 1z0-808 Questions]

Given:

What is the result?

  • A. 10:20
  • B. 0:20
  • C. Compilation fails at line n1
  • D. Compilation fails at line n2
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
SoNofPATEL
Highly Voted 1 year, 3 months ago
this() and super() cannot both be used in the same constructor call: In a single constructor, you can either call another constructor in the same class using this() or call a constructor in the superclass using super(). You cannot use both of them in a single constructor call.
upvoted 5 times
...
vic88
Most Recent 6 days ago
Selected Answer: D
D is correct
upvoted 1 times
...
DriftKing
1 year, 3 months ago
Selected Answer: D
D. Compilation fails at line n2 Code - class Vehicle { int x; Vehicle() { this(10); //line n1 } Vehicle(int x) { this.x=x; } } class Car extends Vehicle { int y; Car() { super(); this(20); //line n2 } Car(int y) { this.y = y; } public String toString() { return super.x+ ":" + this.y; } } public class MyClass { public static void main(String args[]) { Vehicle y = new Car(); System.out.println(y); } }
upvoted 1 times
...
Sreeni_A
1 year, 3 months ago
Correct answer D
upvoted 1 times
...
Vicky_65
1 year, 8 months ago
Selected Answer: D
D is correct
upvoted 1 times
...
Ru_H33
1 year, 9 months ago
We can't call Super() and this() simultaneously in constructor.
upvoted 1 times
...
UAK94
2 years, 2 months ago
D is answer. Tested. Output: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Constructor call must be the first statement in a constructor
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago