Created
July 6, 2022 09:56
-
-
Save manjaykumardp/75d74ec5aa74f4e3b36ddcd245476699 to your computer and use it in GitHub Desktop.
program of Arraylist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class ArrayList2 { | |
public static void main(String[] args) { | |
ArrayList<String> arrayList =new ArrayList<>(); | |
System.out.println("Intial size of arraylist"+ arrayList.size()); | |
arrayList.add("A"); | |
arrayList.add("B"); | |
arrayList.add("C"); | |
arrayList.add("D"); | |
System.out.println("Size of arraylist after adding eleemnt"+ arrayList.size()); | |
System.out.println("content of arraylist"+ arrayList); | |
arrayList.add(2,"E"); | |
System.out.println("changed content arraylist"+ arrayList); | |
arrayList.remove(3); | |
arrayList.remove("A"); | |
System.out.println("changed content after removing element"+ arrayList); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment