Java - Constructors
Find the error in the following code:
class Test {
void display() {
this();
}
}class Test {
void display() {
this();
}
}this() usagethis() is used only to call another constructor, not methods.this() inside a method causes a compile-time error.this() cannot be used to call methods -> Option Athis() = constructor call only [OK]this() only in constructors [OK]this() to call methodsthis() with thisthis() works anywhere15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions