The correct statement to create an object named mango of class fruit:

ICSE Class 10 Computer Applications PYQ · 2024 Paper · Section A

1(xvii)1 Mark · 2024 · Section A · 2024 Paper

The correct statement to create an object named mango of class fruit:

Show SolutionHide Solution↓

fruit mango = new fruit();

Reason — In Java, creating an object follows the syntax:

ClassName objectName = new ClassName();

Where:

  • ClassName: The name of the class.
  • objectName: The name of the object.
  • new: Allocates memory for the object.
  • ClassName(): Calls the class's constructor.

Thus, fruit mango = new fruit(); correctly creates mango named object of fruit class.

← Previous questionNext question →

Browse the free Computer Applications sample bank