java, read array, write array, how to read array, how to write array, get data from array, set data to array, how to get data from array, how to set data to array, multi-dimensional arrays Java: how to use array
(Website Helper) Java: how to use array Number of Visitors: Site Map

Java: how to read and write array?



Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
This site provides users with the information about java, read array, write array, how to read array, how to write array, get data from array, set data to array, how to get data from array, how to set data to array, multi-dimensional arrays, and more.

If you think that this site is helpful, please recommend your friends to visit our site.



Java: how to read and write array?

The following is the simple example to read and write array in java programming:

1. Basic array in Java


import java.util.*; public class array{ public static void main(String[] args){ int[] t_array = new int[10]; //Write data to array for (int i = 0; i < t_array.length; i++) { t_array[i] = i; } int sum = 0; //Read data from array for (int i = 0; i < t_array.length; i++) { sum += t_array[i]; } System.out.println(sum); }
2. Multi-dimensional arrays in Java


import java.util.*; public class array{ public static void main(String[] args){ int[][] m_array = new int[8][6]; for (int i=0; i < m_array.length; i++) { for (int j=0; j < m_array[i].length; j++) { System.out.print(" " + m_array[i][j]); } System.out.println(""); } }
(Website Helper) Java: how to use array (c) EduSoftMax - www.edusoftmax.com