Java version history: Difference between revisions

Content deleted Content added
Line 57:
; [[Enumeration (programming)|Enumerations]] : The <code>enum</code> keyword creates a [[type safety|typesafe]], ordered list of values (such as <code>Day.MONDAY</code>, <code>Day.TUESDAY</code>, etc.). Previously this could only be achieved by non-typesafe constant integers or manually constructed classes (typesafe enum pattern). (Specified by [http://www.jcp.org/en/jsr/detail?id=201 JSR 201].)
; [[Variadic function|Varargs]] : The last parameter of a method can now be declared using a type name followed by three dots (e.g. <code>void drawtext(String... lines)</code>). In the calling code any number of parameters of that type can be used and they are then placed in an array to be passed to the method, or alternatively the calling code can pass an array of that type.
; Enhanced '<code>for</code> [[program loop|loop]]' : The <code>for</code> loop syntax is extended with special syntax for iterating over each member of either an array or any {{Javadoc:SE|java/lang|Iterable}}, such as the standard {{Javadoc:SE|java/util|Collection}} classes, using a construct of the form:
 
<!-- The table below indents the code example and following text by 16 pixels -->