Initialize Two dimensional Array
From Java Example Source Code
Contents |
[edit] Overview - Initialize Two dimensional Array
This Java example program indicate how to initialize 2D Array.
[edit] Java Source Code
- Package: example.array
- File: Test2Darray.java
package example.array;
// A two dimensional array of int values is initialized, and the element// at [0][2] is displayed.public class Test2Darray {
public static void main(String args[]) {
int[][] multiD = { { 1, 2, 3, 4 }, { 5, 6, 7 } };
System.out.println("The element at [0][2] is " + multiD[0][2]);
}}
[edit] What Result You Can Get
Run the program, you will get:
The element at [0][2] is 3
[edit] Required External Libraries and/or Files for this Java Example
Need nothing.
[edit] How to Run this Java Example Program
We recommend running this Java example program with Eclipse.
For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.
It's fairly easy.
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
