How to print the table without using the loop and recursion in Java

advertisements

In my application there is need to print values of array. I can not use any loop or recursion and want to print all values from http response. There is any way to print java array without using loop or recursion. For Example I have array int [] ={102,202,..12}. now i want to print values as

102,202 .. 12 . Order maintain is not necessary .


Method 1:

We can print array without using loop or recursion as

  char [] crr = {'A','B','C','D','E','F'};

  System.out.println(" Print Array ="+ Arrays.toString(crr));

Output: Print Array =[A, B, C, D, E, F] 

Method 2: Firstly we make arraylist from array and then print it .

    String [] brr ={"HTML","PHP","JAVA","C"};

    ArrayList<String> arr= new ArrayList<String>(Arrays.asList(brr));

    System.out.println("ArrayList Is ="+arr);

Source : Print array without using loop/recursion