Write a Java program to create a new array list, add some elements (string) and print out the collection


In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..


Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

  1. import java.util.*;
  2. public class Javacollectionexcercise {
  3. public static void main(String[] args) {
  4. List<String> listStrings = new ArrayList<String>();
  5. listStrings.add("Audi");
  6. listStrings.add("BMW");
  7. listStrings.add("Bugatti");
  8. listStrings.add("Ford");
  9. listStrings.add("Honda");
  10. listStrings.add("Hyundai");
  11. System.out.println(listStrings);
  12. }
  13. }


java techstudy.org


Related Topics


Popular Posts


Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.