[Solved] Can you have a method call inside of an array declaration?


should try it yourself, but here you go

    static int [] arr = new int [getcount ()];
    public static void main(String[] args)  {

        System.out.println(arr.length);
    }

    private static int getcount() {
        return 7;
    }

output

7

solved Can you have a method call inside of an array declaration?