Creating and reporting array information using functions - Java Object Oriented Design

Java examples for Object Oriented Design:Method

Description

Creating and reporting array information using functions

Demo Code

public class Main{

    public static void MyFunction(int n) {
        int array[] = new int[n];
        int i;//from  w ww .  j a  va  2  s .  c  om
        InformationArray(array);
    }


    public static void InformationArray(int[] t) {
        System.out.println("Size of array given in argument is:" + t.length);
    }

    public static void main(String[] args) {

        MyFunction(2312);
        MyFunction(2008);
        int x[] = new int[12];
    }
}

Result


Related Tutorials