Sorting

Soal latihan :
 – buat class Sorting
 – declare field List data
 – inisialisasi data pada constructor dengan data Random data sejumlah 100 data
 – buat method untuk menampilkan data ke browser
    public Sorting() {

        data = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 100; i++) {
            data.add(random.nextInt());
        }
        for (int i = 0; i < data.size(); i++) {

            System.out.println("data ke " + (i + 1) + " = " + data.get(i));

        }
    }

    public static void main(String[] args) {
        Sorting sorting = new Sorting();

    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s