Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to make java list

//Creating arraylist example 
ArrayList<String> list = new ArrayList<String>();  
 
//Adding objects in arraylist 
list.add("Mango");    
list.add("Banana");   

//Change the element (index,"new value")
list.set(1,"Dates"); 

//Return the 2nd element, because index starts from 0
System.out.println("Returning element: " + list.get(1)); 
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #java #list
ADD COMMENT
Topic
Name
7+1 =