Content deleted Content added
rewrite/add references for all keywords relating to variable/method return type declaration |
rewrite/add references for all keywords relating to control-flow structures |
||
Line 24:
:This keyword is also be used to declare that a method returns a value of type <code>byte</code>.<ref name="return" />
;<code id="case">[[Switch statement#Java|case]]</code>
:The <code>case</code> keyword is used to create individual cases in a [[switch statement]]; see ''<code>[[#switch|switch]]</code>''.<ref name="switch">{{cite web |title=The switch Statement |url=http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html |work=The Java Tutorials |publisher=Sun Microsystems, Inc. |date=February 14, 2008 |accessdate=2008-12-03}}</ref>
;<code>[[Exception handling syntax#Java|catch]]</code>
Line 44:
:Used to resume program execution at the end of the current loop body. If followed by a label, <code>continue</code> resumes execution at the end of the enclosing labeled loop body.
;<code id="default">[[Switch statement#Java|default]]</code>
:The <code>default</code> can optionally be used in a [[switch statement]] to label a block of statements to be executed if no <code>case</code> matches the specified value; see ''<code>[[#switch|switch]]</code>''.<ref name="switch" />
;<code id="do">[[do while loop#Java|do]]</code>
:The <code>do</code> keyword is used in conjunction with <code>[[#while|while]]</code> to create a [[do-while loop]], which executes a block of statements assocated with the loop and then tests a boolean expression assocated with the <code>while</code>. If the expression evaluates to <code>true</code>, the block is executed again; this continues until the expression evaluates to <code>false</code>.<ref name="do-while">{{cite web |title=The while and do-while Statements |url=http://java.sun.com/docs/books/tutorial/java/nutsandbolts/while.html |work=The Java Tutorials |publisher=Sun Microsystems, Inc. |date=February 14, 2008 |accessdate=2008-12-03}}</ref>
;<code>[[Double precision|double]]</code>
Line 55:
:This keyword is also used to declare that a method returns a value of type <code>double</code>.<ref name="return" />
;<code id="else">[[Conditional statement|else]]</code>
:The <code>else</code> keyword is used in conjunction with <code>[[#if|if]]</code> to create an [[conditional (programming)|if-else statement]], which tests a [[boolean expression]]; if the expression evaluates to <code>true</code>, the block of statements associated with the <code>if</code> are evaluated; if it evaluates to <code>false</code>, the block of statements associated with the <code>else</code> are evaluated.<ref name="if-else">{{cite web |title=The if-then and if-then-else Statements |url=http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html |work=The Java Tutorials |publisher=Sun Microsystems, Inc. |date=February 14, 2008 |accessdate=2008-12-03}}</ref>
;<code>[[Enumerated type|enum]]</code> (as of J2SE 5.0)
Line 77:
;<code>[[for loop#Java|for]]</code>
:The <code>for</code> keyword is used to create a [[for loop]], which specifies a variable initialization, a [[boolean expression]], and an incrementation. The variable initialization is performed first, and then the boolean expression is evaluated. If the expression evaluates to <code>true</code>, the block of statements assocated with the loop are executed, and then the incrementation is performed. The boolean expression is then evaluated again; this continues until the expression evaluates to <code>false</code>.<ref name="for">{{cite web |title=The for Statement |url=http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html |work=The Java Tutorials |publisher=Sun Microsystems, Inc. |date=February 14, 2008 |accessdate=2008-12-03}}</ref>
:As of [[Java version history#J2SE 5.0 (September 30, 2004) (EOL)|J2SE 5.0]],{{fact}} the <code>for</code> keyword can also be used to create a so-called "[[for each loop|enhanced for loop]]", which specifies an [[array]] or {{Javadoc:SE|java/lang|Iterable}} object; each iteration of the loop executes the associated block of statements using a different element in the array or Iterable.<ref name="for" />
;<code>[[GOTO|goto]]</code> (reserved without use)▼
:Although reserved as a keyword in Java, <code>goto</code> is not used and has no function.<ref name="keywords" />
;<code id="if">[[
:
;<code>implements</code>
Line 143 ⟶ 145:
:Also used to specify a lower bound on a type parameter in Generics.
;<code id="switch">[[Switch statement#Java|switch]]</code>
:The <code>switch</code> keyword is used in conjunction with <code>[[#case|case]]</code> and <code>[[#default|default]]</code> to create a [[switch statement]], which evaluates a variable, matches its value to a specific <code>case</code>, and executes the block of statements associated with that <code>case</code>. If no <code>case</code> matches the value, the optional block labelled by <code>default</code> is executed, if included.<ref name="switch" />
;<code>[[Mutual exclusion|synchronized]]</code>
Line 172 ⟶ 174:
:Used in field declarations to specify that the variable is modified [[asynchronous]]ly by concurrently running threads. Methods, classes and interfaces thus cannot be declared ''volatile''.
;<code id="while">[[do while loop#Java|while]]</code>
:The <code>while</code> keyword is used to create a [[while loop]], which tests a [[boolean expression]] and executes the block of statements associated with the loop if the expression evaluates to <code>true</code>; this continues until the expression evaluates to <code>false</code>. This keyword can also be used to create a [[do-while loop]]; see ''<code>[[#do|do]]</code>''.<ref name="do-while" />
==[[Reserved word]]s for [[literal]] values==
|