Which of the following 2D Array declarations is correct? int]m1 = new int[3][3]; int00 m2; m2 = new int[3][3]; III. int[3][3] = new m3; } 1. II. Using the above - choose an answer * I only II only III only I and II only I, II, and III Which of the following 2D Array declarations is correct? 1. intm1= {1,2,3), (4,5,6); II. int]m2= {(1,2,3), (4,5,6}); III. int[m3= {{1,2,3), {4,5,6}); Using the above - Choose an answer * I only II only III only I and II only II and III only

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question

questions are in the attached pics! thanks!

Which of the following 2D Array declarations is correct?
1. int[][] m1 = new int[3][3];
II.
int00 m2;
m2 = new int[3][3];
III. int[3][3] = new m3; }
Using the above - choose an answer *
I only
II only
III only
I and II only
I, II, and III
Which of the following 2D Array declarations is correct?
1. int[][]m1 =
{1,2,3), (4,5,6);
II. int] m2=
{{1,2,3), (4,5,6});
III. int[]] m3=
{(1,2,3),
{4,5,6});
Using the above - Choose an answer *
I only
II only
III only
I and II only
II and III only
Transcribed Image Text:Which of the following 2D Array declarations is correct? 1. int[][] m1 = new int[3][3]; II. int00 m2; m2 = new int[3][3]; III. int[3][3] = new m3; } Using the above - choose an answer * I only II only III only I and II only I, II, and III Which of the following 2D Array declarations is correct? 1. int[][]m1 = {1,2,3), (4,5,6); II. int] m2= {{1,2,3), (4,5,6}); III. int[]] m3= {(1,2,3), {4,5,6}); Using the above - Choose an answer * I only II only III only I and II only II and III only
Consider the following static 2D array declaration
int[] list1 = {1,2,3);
int[] list2 = {4,5,6);
int[] list3 = (7,8,9);
int matrix = {list1,list2,list3);
What is shown by the declaration? *
O It shows a quicker way to declare a 2D static array.
O A 2D static array is an array of arrays.
O
The initializer list is the best declaration for 2D arrays.
The initializer list can only be used with int elements.
An incorrect declaration. new should be used for a declaration.
Consider the following dynamic 2D array declarations.
ArrayList<Integer> list1 = new ArrayList<Integer>();
list1.add(100);
list1.add(200);
ArrayList<Integer> list2 = new ArrayList<Integer>();
list2.add(300);
list2.add(400);
ArrayList<Integer> list3 = new ArrayList<Integer>();
list3.add(500);
list3.add(600);
ArrayList<ArrayList<Integer>> matrix = new ArrayList<ArrayList<Integer>>();
matrix.add(list1);
matrix.add(list2);
matrix.add(list3);
What is shown by the declaration above? *
O It shows a quicker way to declare a 2D static array
O A 2D dynamic array is an array of arrays.
C The initializer list is the best declaration for 2D arrays.
The initializer list can only be used with int elements.
An incorrect declaration. new should be used for a declaration.
Transcribed Image Text:Consider the following static 2D array declaration int[] list1 = {1,2,3); int[] list2 = {4,5,6); int[] list3 = (7,8,9); int matrix = {list1,list2,list3); What is shown by the declaration? * O It shows a quicker way to declare a 2D static array. O A 2D static array is an array of arrays. O The initializer list is the best declaration for 2D arrays. The initializer list can only be used with int elements. An incorrect declaration. new should be used for a declaration. Consider the following dynamic 2D array declarations. ArrayList<Integer> list1 = new ArrayList<Integer>(); list1.add(100); list1.add(200); ArrayList<Integer> list2 = new ArrayList<Integer>(); list2.add(300); list2.add(400); ArrayList<Integer> list3 = new ArrayList<Integer>(); list3.add(500); list3.add(600); ArrayList<ArrayList<Integer>> matrix = new ArrayList<ArrayList<Integer>>(); matrix.add(list1); matrix.add(list2); matrix.add(list3); What is shown by the declaration above? * O It shows a quicker way to declare a 2D static array O A 2D dynamic array is an array of arrays. C The initializer list is the best declaration for 2D arrays. The initializer list can only be used with int elements. An incorrect declaration. new should be used for a declaration.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT