Saturday 26 August 2017

Simple java ArrayList Program

Program:

package JavaCoders;
import java.util.*;
class ArrayList1
{
public static void main(String[] x)
{
ArrayList<String>ar=new ArrayList<String>();
ArrayList ar1=new ArrayList();
ArrayList ar2=new ArrayList();
ArrayList ar3=new ArrayList();


ar.add("BALWANT");
ar.add("SINGH");
ar1.add("VISIT");
ar1.add("WEBSITE");
ar2.add("JAVACODERS");
ar2.add("LINK IS");
ar3.add("https://wingsofm.blogspot.in/");
ar3.add("YOU CAN FOLLOW ME");
ar.addAll(ar1);
ar.addAll(ar2);
ar.addAll(ar3);
for(String s:ar)
{
System.out.println(s);
}
}
}
OUTPUT:


Simple-java-ArrayList-Program

If You want to Explore more in ArrayList You can go to this link:

https://wingsofm.blogspot.in/2017/05/how-add-method-works-in-arraylist-in.html

This tutorial will tell you about basic features of arraylist and methods for implementing it with good example.

1 comment:

  1. Lucky Club Casino Site » Up to €500 Welcome Bonus!
    Lucky Club offers players a thrilling selection of virtual games. Experience the thrill of casino games with the biggest jackpot prizes of the day, and up to €500 luckyclub.live

    ReplyDelete

Oracle / PLSQL: FOR LOOP

set serveroutput on; declare a1 varchar2(100); begin select count(*) into a1 from employees; for i in 1..a1 loop dbms_output.put_line...