All Subjects
Light
collapse
Practice Quizzes
AP Computer Science A
Unit 8 – 2D Arrays in AP Computer Science A
Topic null
How would you initialize a pre-existing 2D array with the values: {1, 2, 3, 4} in the first row, {5, 6, 7, 8} in the second row, and {9, 10, 11, 12} in the third row?
int[][] arrayB = new int{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int[][] arrayB = new int[3][4];
int[][] arrayB = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int arrayB[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
Related content
Practice quizzes
Practice this subject
Practice this unit
Practice this topic
Additional resources (1)
AP Computer Science A - 8.1 2D Arrays
Key terms
2D array
Initialize
Pre-existing
About Us
About Fiveable
Blog
Careers
Testimonials
Code of Conduct
Terms of Use
Privacy Policy
CCPA Privacy Policy
Resources
Cram Mode
AP Score Calculators
Study Guides
Practice Quizzes
Glossary
Crisis Text Line
Request a Feature
Report an Issue
Stay Connected
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
About Us
About Fiveable
Blog
Careers
Testimonials
Code of Conduct
Terms of Use
Privacy Policy
CCPA Privacy Policy
Resources
Cram Mode
AP Score Calculators
Study Guides
Practice Quizzes
Glossary
Crisis Text Line
Request a Feature
Report an Issue
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
Back
Practice Quiz
Guides
Glossary
Guides
Glossary
Next