ADBRITE ads links
You are here: CodeIdol.com > Java > Programmer's Guide to Java Certification > Operators And Assignments
Programmer's Guide to Java Certification
| Exam Objectives
Determine the result of applying any operator (including assignment operators and the instanceof operator) to operands of any type, class, scope, or accessibility, or...
|
|
| Precedence and associativity rules are necessary for deterministic evaluation of expressions. The operators are summarized in Table 3.1. They are discussed in subsequent sections in...
|
|
| In order to understand the result returned by an operator, it is important to understand the evaluation order of its operands. Java states that the...
|
|
| In this section we discuss the different kinds of type conversions and list the contexts in which these can occur. Some type conversions must be...
|
|
| =
The assignment statement has the following syntax:
<variable> = <expression>
which can be read as "the destination, <variable>, gets the value of the source, <expression>". The previous value of...
|
|
| 3.1
Given char c = 'A';
What is the simplest way to convert the character value in c into an int?
Select the one correct answer.
int i =...
|
|
| *, /, %, +, -
The arithmetic operators are used to construct mathematical expressions as in algebra. Their operands are of numeric type (which includes the...
|
|
| Review Questions
3.4
Which of the following expressions will be evaluated using floating-point arithmetic?
Select the three correct answers.
* * + 5/+ 1.* 1L * 300.03.5
What is the...
|
|
| +
The binary operator + is overloaded in the sense that the operation performed is determined by the type of the operands. When one of the...
|
|
| ++, --
Variable increment (++) and decrement (--) operators come in two flavors: prefix and postfix. These unary operators have the side effect of changing the...
|
|
| 3.10
Which statements are true?
Select the three correct answers.
The result of the expression (1 + 2 + "3") would be the string "33".The result of the...
|
|
| Boolean expressions have boolean data type and can only evaluate to the values true or false.
Boolean expressions, when used as conditionals in control statements, allow...
|
|
| <, <=, >, >=
Given that a and b represent numeric expressions, the relational (also called comparison) operators are defined as shown in Table 3.6.
Table 3.6....
|
|
| Primitive Data Value : ==, !=
Given that a and b represent operands of primitive data types, the primitive data value equality operators are defined as...
|
|
| Boolean Logical Operators: !, ^, &, |
Boolean logical operators include the unary operator ! (logical complement) and the binary operators & (logical AND), | (logical...
|
|
| &&, ||
Conditional operators && and || are similar to their counterpart logical operators & and |, except that their evaluation is short-circuited. Given that x...
|
|
| 3.15
Which of the following expressions evaluates to true?
Select the two correct answers.
(false | true)(null != null)(4 <= 4)(!true)(true & false)3.16
Which statements are true?
Select the two...
|
|
| Integer Bitwise Operators: ~, &, |, ^
A review of number representation (see Section G.4, p. 598) is recommended before continuing with this section on how...
|
|
| <<, >>, >>>
The binary shift operators form a new value by shifting bits either left or right a specified number of times in a given...
|
|
| ?
The ternary conditional operator allows conditional expressions to be defined. The operator has the following syntax:
<condition> ? <expression1> : <expression2>
If the boolean expression <condition> is true then <expression1> is...
|
|
| new, [], instanceof
The new operator is used to create objects, that is, instances of classes and arrays. It is used with a constructor call to...
|
|
| 3.20
What would be printed during execution of the following program?
public class MyClass {
public static void main(String[] args) {...
|
|
| Objects communicate by passing messages (see Section 1.4, p. 7). A message is implemented as a method call to invoke a particular method on an...
|
|
| When the actual parameter is a variable of a primitive data type, the value of the variable is copied to the formal parameter at method...
|
|
| If an actual parameter is a reference to an object, then the reference value is passed. This means that both the actual parameter and the...
|
|
| Passing Array References
Arrays are objects in Java (see Section 4.1, p. 100). A review of arrays is recommended before continuing with this section.
The discussion on...
|
|
| Array elements, like other variables, can store values of primitive data types or references to objects. In the latter case it means they can also...
|
|
| final
A formal parameter can be declared with the keyword final preceding the parameter declaration in the method definition. A final parameter is also known...
|
|
| Any arguments passed to the program on the command line can be accessed in the main() method of the class specified on the command line:
java...
|
|
| 3.25
What will be printed when the following program is run?
public class ParameterPass {
public static void main(String[] args) {...
|
|
| Chapter Summary
The following topics were explained in this chapter:
operators in Java, including precedence and associativity rulestype conversions: casting, narrowing and widening: in addition, the unary...
|
|
| 3.1
The program below is supposed to calculate and show the time it takes for light to travel from the sun to the earth. It contains...
|
|
You are here: CodeIdol.com > Java > Programmer's Guide to Java Certification > Operators And Assignments
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|