/* related posts with thumb nails */

Create an anonymous array in JAVA. (Anonymous Array: An array without any name):

class AnonymousArray

{

public static void main(String args[])

{

System.out.println(“Length of array is “ + findLength(new int[]{1,2,3}));

}

public static int findLength(int[] array)

{

return array.length;

}

}

Output:

Length of array is 3

Related Topics:

0 comments:

Post a Comment