1. 学习
  2. /
  3. 课程
  4. /
  5. Input/Output and Streams in Java

Connected

练习

Displaying city names

Managing sets of locations is a common task in applications like travel planning, navigation systems, or user-generated location sets. In this exercise, you will practice using an enhanced for-loop to display a set of cities. This approach ensures you can easily retrieve and process city names from a collection.

The HashSet class has been imported for you.

说明

100 XP
  • Use an enhanced for-loop to travel through the created set cities.
  • Print each city inside the loop.