Returning An Array
      This program explains how to return array from a method.We declare the return type of the method as an array and accept the returned value in an array.
/*
	http://www.ProbCOMP.com
	
	This program explains how to return array from a method.
	We declare the return type of the method as an array and accept
	the returned value in an array.


*/

class ReturnArray{
	
	public static int[] returnArray()
	{
		int[] array = new int[5];
		
		for(int i=0;i<5;i++)
			array[i]=i;
		return array;
	}
	
	public static void main(String args[])
	{
		int[] array = returnArray();
		for(int i=0;i<5;i++)
			System.out.println(array[i]);
	}

}
									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More