Harry Quince
Harry Quince

Reputation: 2414

What's the best way to get up to speed on changes in Java syntax since 2001?

Duplicate: How do I best catch up with the latest developments in java?

I've been working on a Java codebase that was frozen in time around 2001. As a result I haven't bothered to learn any new Java syntax since then.

Today I saw this code and recognized it as a syntax that must have been introduced in the current decade.

private ArrayList<String> colors = new ArrayList<String>();

Which version of Java introduced this angle-bracket notation?

And what would be a good way to learn about other significant changes to the language since 2001? I have a pretty good grasp of everything before that date.

Upvotes: 1

Views: 245

Answers (3)

Eddie
Eddie

Reputation: 54431

Of all recent Java release, Java 5 made the largest and most obvious changes to the language. The summary lists all the new features. In brief:

  • autoboxing
  • enum, e.g., enum Season { WINTER, SPRING, SUMMER, FALL }
  • Generics, e.g., Collection<String> coll; instead of Collection coll;
  • ehanced for loop, e.g., for (String str : coll)
  • varargs, e.g., private void function(Object... arguments);
  • static import
  • Annotations, e.g., @Override or @Deprecated
  • String.format like a Java version of printf()

Java 4 introduced a few new features too, primarily assertions.

If you prefer books, you can learn about Java 5 changes from the book Java 5.0 Tiger: A Developer's Notebook. This isn't the most comprehensive book you'll find, but it's a nice and quick introduction to all of the new features of Java 5.

Upvotes: 4

Bj&#246;rn
Bj&#246;rn

Reputation: 29401

You're referring to generics, introduced in Java SE 1.5 (or Java 5). Enums got a bit more exciting in the Java 5 release as well as the Java autoboxing and unboxing, annotations and much much more.

http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html

http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html

Overview: http://java.sun.com/j2se/1.5.0/docs/guide/language/

When you want to get up to speed on Java 6, check out http://java.sun.com/javase/6/features.jsp

Upvotes: 2

Uri
Uri

Reputation: 89859

The <> notation has to do with generics (like templates). This, like most major changes, have been introduced in Java 5, along with many other language features.

Here are the updates for Java 5: http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html

You can find details about specific changes in the Java tutorial.

As far as I know, the changes in later version (e.g., 1.6) are not major: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/beta2.html

Upvotes: 1

Related Questions