array java methods code example
Example 1: Arrays in java
public class AccessingArrayElements
{
public static void main(String[] args)
{
int[] arrNum = {25, 23, 15, 20, 24};
for(int a = 0; a < arrNum.length; a++)
{
System.out.println(arrNum[a]);
}
}
}
Example 2: arrays in java
int[] arr;
arr = new int[N];
Example 3: array methods in java
String[] aArray = new String[5];
String[] bArray = {"a","b","c", "d", "e"};
String[] cArray = new String[]{"a","b","c","d","e"};
Example 4: java Arrays method
int[] intArray = { 1, 2, 3, 4, 5 };
String intArrayString = Arrays.toString(intArray);
System.out.println(intArray);
System.out.println(intArrayString);