Question: Assume that the following program compiles and runs. What would be the output of this program? import java.util.ArrayListi public class Airports public static void main

 Assume that the following program compiles and runs. What would be

Assume that the following program compiles and runs. What would be the output of this program? import java.util.ArrayListi public class Airports public static void main (String args) ArrayList airports- new ArrayList(); airports.add ("BNE" airports.add("MEL") airports.add ("SYD" airports.add ("ADL") airports.add("HBA") int n - airports.size) System.out.println ("The list has "+nt" entries.") if airports.contains("hba" System.out.println ("The list contains hba") else System.out.println ("The list does not contain hba") String airport -airports.get (2); System.out.println ("The airport is "airport); System.out.printf ("The airports are:") for (String a airports) ", a); System.out.printf("%s System.out.println); airports.remove (1) airports.add 1, "CBR) System.out.printf ("The airports are:") for (String a airports ", a); System.out.printf("%s System.out.println)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!