Printing array using recurrence method

import java.io.*;
class PrintArray{
 static int i=0,j=0;
 public static void main(String ar[])throws IOException{
  int a[]={23,23,23,5,45,4,65,6,34,7,56,7,88,78,7,5,45,6,4}; 
  printArray(a);
 }
 public static void printArray(int arr[]){
  if(i>arr.length-1)
  {
   return;
  }
  else
  {
   System.out.println(" "+arr[i]);
   i++;
   printArray(arr);
  }
 }
}

No comments:

Popular Posts