how to return array in java

Solutions on MaxInterview for how to return array in java by the best coders in the world

showing results for - "how to return array in java"
Ilene
01 Jan 2017
1public static int[] numbers()  
2{  
3int[] arr={5,6,7,8,9};  //initializing array  
4return arr;  
5}  
Noemi
30 Mar 2016
1import java.util.Arrays;
2
3public class trial1{
4
5    public static void main(String[] args){
6        int[] B = numbers();
7        System.out.println(Arrays.toString(B));
8    }
9
10    public static int[] numbers(){
11        int[] A = {1,2,3};
12        return A;
13    }
14}
15