2.8 Expression
Performs the mathematical or logical operation Op on the value of the two expressions.
- Expression
! Expression
Performs logical negation on the value of the expression.
Allows access to the current object. Within a class, fields and methods of the current class can be accessed through this.
Id names a method of the current class to be called by the current expression. The expressions following Id are evaluated from left to right and passed in to the method as its arguments. The number and types of the arguments must match the method’s declaration. These values replace the argument names in the body of the method, and the result of the body is the result of this expression.
Expression.Id (Expression ,...)
The first expression must evaluate to an object value. Id names a method of this object to be called by the current expression. The expressions following Id are evaluated from left to right and passed in to the method as its arguments. The number and types of the arguments must match the method’s declaration. These values replace the argument names in the body of the method, and the result of the body is the result of this expression.
Evaluates the overridden method body using the provided expressions as its arguments.
The first expression must evaluate to an object value. Id names a field of this object, whose value is retrieved by this expression.
Evaluates to a new instance (object) of the Id class. The class’s constructor will be run with the given values (evaluated from left to right) as its arguments. These values must be the correct number and type as specified by the constructor.
Evaluates Expression and then confirms that the value matches the specified type. During compilation, the resulting expression has the specified type. If during evaluation, this is not true, an error is raised; otherwise the result of this expression is the result of Expression.
Evaluates Expression and then confirms that the value matches the specified type. Returns true when the type matches and false otherwise.
check Expression expect Expression
Compares the resulting values of the two expressions through a deep comparison, including the fields of objects. The resulting value will be a boolean. Neither expression can have type float or double. When test reporting is enabled, results of checks appear in the testing window.
check Expression expect Expression within Expression
Compares the resulting values of the first two expressions through a deep comparison. The third value must be numeric. If the resulting values of the compared expressions are numeric, their values must be within the third value of each other. For example, in check a expect b within c, the absolute value of a-b must be less than or equal to c. If the compared expressions evaluate to objects, any numeric fields will be compared with this formula. The resulting value will be a boolean. When test reporting is enabled, results of checks appear in the testing window.
Id
May refer to either a local variable, method parameter, or field of the current class.
Number
Character
Values of type char are ASCII characters enclosed by single quotes such as ’a’ is the character a. They can be used as numbers as well as characters.
String
Strings are created through placing text inside of double quotes. For example "I am a string" is a String. A String value is an instance of the class String, which descends from Object, and can also be created with a constructor.
null
A value representing an object with no fields or methods. It should be used as a placeholder for uninitialized fields.
true
false