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

Connected

练习

Navigating with Enum

Enums are great for representing real-world directions clearly in code. Imagine you're creating a navigation feature for an application that provides instructions to users.

说明

100 XP
  • Define an enum named Direction containing constants: NORTH, EAST, SOUTH, and WEST.
  • Create a method with a Direction parameter.
  • Print the EAST direction using printDirection().