List Array in java
import java.util.ArrayList; // importing the libray
import java.util.List; // importing the library
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
List<String> list = new ArrayList<>(); // intializing the ArrayList
list.add("bashar"); // adding the items in the list
list.add("alam");
System.out.println("this is the list array "+list);
list.clear(); //clearing the full list
System.out.println("after clearing the list "+list);
}
}
Comments
Post a Comment