create Double Array using Array.newInstance - Java java.lang

Java examples for java.lang:double Array

Description

create Double Array using Array.newInstance

Demo Code


//package com.java2s;
import java.lang.reflect.Array;

public class Main {
    public static void main(String[] argv) throws Exception {
        int rows = 2;
        int cols = 2;
        System.out.println(java.util.Arrays.toString(createDoubleArray(
                rows, cols)));/* w  w  w . j  av a  2s .c o  m*/
    }

    public static double[][] createDoubleArray(int rows, int cols) {
        return (double[][]) Array.newInstance(double.class, rows, cols);
    }
}

Related Tutorials