1. Learn
  2. /
  3. Courses
  4. /
  5. Input/Output and Streams in Java

Connected

Exercise

Managing Web Responses with Enums

Using enums to manage HTTP responses can simplify handling different status codes in web applications. This exercise demonstrates creating enums that include additional information like HTTP status codes.

Instructions

100 XP
  • Define an int parameter code for the HttpStatus constructor.
  • Return field code when method getCode() is called.
  • Print HttpStatus code for status OK.