What will expression salesiength return for an array sales[5][12] ?(a) 5
(b) 12
(c) 60
(d) 120
Answers
Answered by
3
hello here is your answer by Sujeet yaduvanshi
Q:-What will expression salesiength return for an array sales[5][12] ?(a) 5
(b) 12
(c) 60
(d) 120
Answer:-)60
Q:-What will expression salesiength return for an array sales[5][12] ?(a) 5
(b) 12
(c) 60
(d) 120
Answer:-)60
Answered by
8
The correct option is (a) 5
Explanation:
Program
public class Main
{
public static void main(String[] args) {
int[][] sales = new int[5][12];
System.out.println("Length return by sales array is "+sales.length);
}
}
--The two dimensional (2D) refers to a collection of elements of the same type having single array name.
--It is stored as a table of number of rows and columns.
--The length will return number of rows in a given two-dimensional array
Output:
Length return by sales array is 5
The compiled program is attached below:
Attachments:
Similar questions