Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions