NEWS: Total Picture Views: 155282 | Total Article Views: 165609 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. PickUpThings with Becker Robot | 3. How to read a JSON and work with it | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

ArrayList Example Java

Description:

In this example I will be showing how to use a Arraylist in Java

Code:

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author Jean-Mathieu
 */
public class arrayListExample {
    static ArrayList al = new ArrayList();
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        for(int i=0;i<10;i++){
            arrayList(i);
        }
        for(int y=0;y<10;y++){
            System.out.println(al.get(y));
        }
        
    }
    
   
    public static void arrayList(int value){
            al.add(value);
    }

    
}
Attachments: None

Tags: Arraylist For loop Scanner

Total Views: 1035

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 11/18/14


affiliate_link

Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.