1int[] data = {10,20,30,40,50,60,71,80,90,91};
2// or
3int[] data;
4data = new int[] {10,20,30,40,50,60,71,80,90,91};
5// or
6int[] data = new int[10];
7data = {10,20,30,40,50,60,71,80,90,91};
1 // first way
2int[] array = {1, 2, 3, 4, 5};
3
4 // second way
5int[] array;
6data = new int[] {2, 4, 6, 8, 10};
7
8// third way
9int[] array = new String[10]; // this array can hold 10 elements
10data = {1, 3, 5, 7, 9};
11
12// fourth way
13int[] array = new int[10];
14array[0] = 3;
15array[1] = 5; // assign value one by one
16
17// if you have a method that returns an array, you can do this
18public String[] getArray() {
19 return new String[] {"honey", "bee"};
20}