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 week, 3 days agod7bb0b2
5 months agoTheOneAboveAll
8 months agoOmnisumem
8 months, 3 weeks agoStavok
10 months, 3 weeks agoObalt
1 year, 4 months ago