60.6k views
0 votes
Which of the following statements calls a constructor method where Qwerty is a class identifier?

a. balloon = new Qwerty;
b. Qwerty.balloon();
c. Qwerty balloon = new Qwerty();
d. Qwerty = new balloon();

1 Answer

5 votes

Final answer:

The correct way to call a constructor and create a new instance of a class named Qwerty is 'Qwerty balloon = new Qwerty();' from the given options.

Step-by-step explanation:

The student's question is asking which of the given options correctly calls a constructor method for a class named Qwerty in programming. The correct option that creates a new instance of the Qwerty class using its constructor is option c: Qwerty balloon = new Qwerty();. This line of code declares a variable of type Qwerty named balloon and assigns it a new instance of the Qwerty class. The new keyword is used to call the constructor of a class and create an object.

User Deepender Singla
by
8.0k points