program 11
This commit is contained in:
13
ArrayListDemo.java
Normal file
13
ArrayListDemo.java
Normal file
@@ -0,0 +1,13 @@
|
||||
// 11 write a java program to demonstrate Array List
|
||||
import java.util.ArrayList;
|
||||
public class ArrayListDemo{
|
||||
public static void main(String[] args){
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
arrayList.add("Element 1");
|
||||
arrayList.add("Element 2");
|
||||
arrayList.add("Element 3");
|
||||
System.out.println("Element at index 0: " + arrayList.get(0));
|
||||
System.out.println("Element at index 1: " + arrayList.get(1));
|
||||
System.out.println("Element at index 2: " + arrayList.get(2));
|
||||
}
|
||||
}
|
||||
BIN
Screenshots/program11.png
Normal file
BIN
Screenshots/program11.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user