Java tab Syntax Button Descriptions
Use the Java tab syntax buttons to add statements to an expression. Clicking on one of the buttons adds the indicated syntax (minus the question marks) to your expression. In the spaces left by the question marks, enter the appropriate values.
Syntax Button |
Enters into the Expression Editor palette, the syntax for a... | ||
---|---|---|---|
{ ? } |
Block statement. A block statement or block is a sequence of statements and local variable declaration statements within braces. See “Blocks and Statements” at http://java.sun.com/docs/books/jls/third_edition/html/statements.html | ||
return ? |
Return statement. Returns control to the evaluator of a complex expression block. See “Branching Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/branch.html | ||
new ? |
New operator. The operand represents the friendly data type or the fully qualified Java class name of the object to create. Creates and allocates space for a new object. | ||
if ( ? ) ? |
If statement. Conducts a conditional test and executes a block of statements if the test evaluates to true. See “The if/else Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html | ||
if ( ? ) ? else ? |
If-else statement. Conducts a conditional test and executes a block of statements if the test evaluates to true. Allows conditional execution of a statement or a conditional choice of two statements, executing one or the other but not both. See “The if/else Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html | ||
else ? |
Else statement. Executes a block of statements in the case that the test condition with the "if" keyword evaluates to false. See “The if/else Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html | ||
while ( ? ) ? |
While statement. Executes a Statement repeatedly until the value of the Expression is false. The Expression must have type Boolean, or a parse-time error occurs. If the value of the Expression is false the first time it is evaluated, then the Statement is not executed. See “The while and do-while Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/while.html | ||
do ? while ( ? ) |
Do-While statement. Executes a Statement and an Expression repeatedly until the value of the Expression is false. The Expression must have type Boolean, or a parse-time error occurs. Executing a do statement always executes the contained Statement at least once. See “The while and do-while Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/while.html | ||
for ( ?. ?. ?) ? |
For statement. Executes some initialization code, then executes an Expression, a Statement, and some update code repeatedly until the value of the Expression is false. See "The for Statement" at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html | ||
break |
Break statement. Transfers control out of an enclosing statement. See “Branching Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/branch.html | ||
continue |
Continue statement. Passes control to the loop-continuation point of an iteration statement. A continue statement may occur only in a while, do, or for statement; statements of these three kinds are called iteration statements. See “Branching Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/branch.html | ||
switch ( ? ) { ? }
|
Switch statement. The switch statement transfers control to one of several statements depending on the value of an expression. The type of the Expression must be char, byte, short, int, BigInteger, float, double, BigDecimal, String, or Language, or a parse-time error occurs. This is an extension on the Java programming language where only the types char, byte, short, or int are supported. String switch statements are case insensitive. See “The switch Statement” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html | ||
case ?: |
Case statement. A block of code or a code branch destinations depending on the value of an expression in a switch statement. See “The switch Statement” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html | ||
default: |
Default statement. Optionally used after all "case" conditions in a "switch" statement. If all "case" conditions are not matched by the value of the "switch" variable, the "default" statement is executed. | ||
throw ? |
Throw statement. Causes an exception to be thrown. The result is an immediate transfer of control that may exit multiple statements and the complex expression block containing it until a try statement is found that catches the thrown value. See “Method Throws” at http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.6 | ||
try { ? } catch (? ) { ? } |
Try-catch statement. A try statement executes a block. If a value is thrown and the try statement has one or more catch clauses that can catch it, then control is transferred to the first such catch clause. See “Exception Handling Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/exception.html | ||
try { ? } finally { ? } |
Try-finally statement. If the try statement has a finally clause, then another block of code is executed, no matter whether the try block completes normally or abruptly, and no matter whether a catch clause is first given control. See “Exception Handling Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/exception.html | ||
catch ( ? ) { ? } |
Catch statement. Encloses some code and is used to handle errors and exceptions that might occur in that code. See “Exception Handling Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/exception.html | ||
finally { ? } |
Finally statement. Unconditionally executed after all other error processing has occurred. This guarantees execution of cleanup code when execution of a block of code is interrupted. See “Exception Handling Statements” at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/exception.html |