Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;

public class Main {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");
        list.add("E");
        list.add("F");
        list.add("G");
        list.add("H");

        System.out.println(list);

        while (!list.isEmpty()) {
            long index = Math.round(Math.floor(Math.random() * list.size()));
            System.out.println("Name " + list.get((int) index));
            list.remove((int) index);
        }

    }
}