answer: C
Automatic invocation of a superclass constructor must be the first line in the subclass constructor.
Doesn't matter parameterized or not.
//default constructor not inserted
class ConSub
ConSub() {
this(4)
}
//default constructor is inserted
ConSub(int a) {
System.out.println(a);
}
//default constructor not inserted
// default class ConSuper - ok
// protected constructor - ok
class ConSuper {
protected ConSuper() {
this(2);
System.out.println("3");
}
//default constructor is inserted
class ConSuper {
protected ConSuper(int a) {
System.out.println(a);
}
Object default constructor
>2
>23
>234
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.
ASPushkin
1 month, 2 weeks agod7bb0b2
6 months, 1 week agoTheOneAboveAll
9 months agoOmnisumem
10 months agoStavok
12 months agoObalt
1 year, 5 months ago