Alex Rivera | Logout

What Java feature(s) historically started as a pattern and is now a language feature?

Asked 2011-03-14T16:50:21.510
26

I'll be honest. I need help with a homework question that I'm stumped with.

Describe something that historically started as a pattern and is now supported with a language feature in Java.

Edit
Report

2 Answers

46

They're probably looking for enums.

Before Java 1.5 introduced language support for enums, standard practice was to define a set of public static final ints as enum values.
This pattern can be seen all over Swing.

Many of these constants are defined in interfaces so that classes can implement the interface and use the constants without a qualifying typename; the SwingConstants interface is a great example.

answered 2011-03-14T16:53:06.793
0
answered 2011-03-14T16:54:56.850

Your Answer