- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I put a Java arrays inside an array?
Example
import java.util.Arrays; public class ArrayWithinAnArray{ public static void main(String args[]) { int[] myArray1 = {23, 56, 78, 91}; int[] myArray2 = {123, 156, 178, 191}; int[] myArray3 = {223, 256, 278, 291}; int[] myArray4 = {323, 356, 378, 391}; int [][] arrayOfArrays = {myArray1, myArray2, myArray3, myArray4}; System.out.println(Arrays.deepToString(arrayOfArrays)); } }
Output
[[23, 56, 78, 91], [123, 156, 178, 191], [223, 256, 278, 291], [323, 356, 378, 391]]
Advertisements