Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Add items to ArrayList Using add() function

import java.util.ArrayList;

class Main {
  public static void main(String[] args){

    // create ArrayList
    ArrayList<String> Websites = new ArrayList<>();

    // add() method without the index parameter
    Websites.add("Softhunt.net");
    Websites.add("Pythonprogramming.com");
    Websites.add("Tutorial.io");
    System.out.println("ArrayList: " + Websites);
  }
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Add #items #ArrayList #Using #function
ADD COMMENT
Topic
Name
3+4 =