I was looking through a code tutorial just now, and found something interesting -- the import static
feature introduced in JDK 5:
import static org.junit.Assert.assertEquals;
public class AdditionTest {
private int x = 1;
private int y = 1;
@Test public void addition() {
int z = x + y;
assertEquals(2, z);
/* ^ this is a static method, normally called by Assert.assertEquals */
}
}
It got me wondering, what other features were introduced in JDK 5 and 6 that I don't know about? Are there other new keyword usages like this? Any noteworthy new library classes or functions?
I know that release notes or changelogs are out there, I'm not looking for an "RTFM" answer. I want to know a short list of, in your opinion, what features you think are most game-changing in JDK 5 or 6.