Question Index

class ConstructorTest {
    private double i;
    public ConstructorTest(double i) {
        this.i = i;
    public ConstructorTest() {
        System.out.println("Default constructor");
    public void t() {
        System.out.println("Invoking t");
Which of the following statement(s) is/are correct?

A. this.t() may be replaced by t()
B. this.i may be replaced by i.
C. this(1) must be called before System.out.println("Default constructor")
D. this(1) must be replaced by this(1.0).

A, B and D
A and C
B, C and D
A and B
Only A
All of them are correct



Topic: Java Access Modifiers With Example Program

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App