English

Identify the correct statement. (a) double dr = new double; (b) double dr = new double; (c) double dr[] = new dr [5]; (d) double dr [] = new double [5];

Advertisements
Advertisements

Question

Identify the correct statement.

Options

  • double dr = new double;

  • double dr = new double;

  • double dr[] = new dr [5];

  • double dr [] = new double [5];

MCQ
Advertisements

Solution

double dr [] = new double [5];

Explanation:

follows perfect Java syntax for array declaration and instantiation. It explicitly declares a reference variable dr for a double array (double dr[]) and allocates memory for exactly 5 elements using the new keyword followed by the data type and size (new double [5]).

shaalaa.com
  Is there an error in this question or solution?
Chapter 2: Class as the Basis of all Computation - Exercises [Page 64]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 2 Class as the Basis of all Computation
Exercises | Q 1. (v) | Page 64
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×