HOW TO PRINT ARRAY WITHOUT USING LOOP AND RECURSION IN JAVA

lois waisbrooker

Total Post:70

Points:494
Posted by  lois waisbrooker
Java  Array 
 1110  View(s)
Ratings:
Rate this:
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 .
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: How to print array without using loop and recursion In java

    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);    

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!