Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Bonsai Boy of New York Bonsai Trees and Accessories

BlueHost Web Hosting

Liquid Web iThemes WordPress Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


getResponse autofunnels

Liquid Web Cloud VPS Hosting

11,407 questions

15,557 answers

573 users

How to print ArrayList in Java

6 Answers

0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);

        for (int i = 0; i < arrlist.size(); i++) {
            System.out.println(arrlist.get(i));
        }
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        System.out.println(Arrays.toString(arrlist.toArray()));
    }
}
 
 
 
 
/*
run:
 
[79.12, 28.01, 47.98, 83.87, 99.31]
 
*/

 




answered Oct 3 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        for (Double n : arrlist) {
            System.out.println(n);
        }
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach((Double value) -> System.out.println(value));
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach(value -> System.out.println(value));
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach(System.out::println);
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3 by avibootz
...