Solved

What Is the Output of the Following Statements? ArrayList<String> CityList

Question 17

Multiple Choice

What is the output of the following statements? ArrayList<String> cityList = new ArrayList<String>() ;
CityList.add("London") ;
CityList.add("New York") ;
CityList.add("Paris") ;
CityList.add("Toronto") ;
CityList.add("Hong Kong") ;
CityList.add("Singapore") ;
System.out.print(cityList.size() ) ;
System.out.print(" " + cityList.contains("Toronto") ) ;
System.out.print(" " + cityList.indexOf("New York") ) ;
System.out.println(" " + cityList.isEmpty() ) ;


A) 5 true 1 false
B) 6 true 2 false
C) 5 false 1 false
D) 6 true 1 false

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions