OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 (Sybex Study Guide)
Rate it:
Open Preview
12%
Flag icon
There's one special package in the Java world called java.lang. This package is special in that it is automatically imported.
14%
Flag icon
code blocks appear outside a method. These are called instance initializers.
14%
Flag icon
The constructor runs after all fields and instance initializer blocks have run.
14%
Flag icon
Java has eight built-in data types, referred to as the Java primitive types.
15%
Flag icon
System.out.println(Integer.MAX_VALUE);
15%
Flag icon
reference types can be assigned null, which means they do not currently refer to an object.
17%
Flag icon
Local variables must be initialized before use. They do not have a default value and contain garbage data until initialized. The compiler will not let you read an uninitialized value.
19%
Flag icon
multiple classes can be defined in the same file, but only one of them is allowed to be public.
19%
Flag icon
A file is also allowed to have neither class be public.
19%
Flag icon
Java provides a method called System.gc(). Now you might think from the name that this tells Java to run garbage collection. Nope! It meekly suggests that now might be a good time for Java to kick off a garbage collection run. Java is free to ignore the request.
22%
Flag icon
Java operator is a special symbol that can be applied to a set of variables, values, or literals—referred to as operands—and that returns a result.
22%
Flag icon
operator precedence.
24%
Flag icon
Numeric Promotion Rules
24%
Flag icon
For the third rule, note that unary operators are excluded from this rule. For example, applying ++ to a short value results in a short value. We'll discuss unary operators in the next section.
24%
Flag icon
floating-point literals are assumed to be double, unless postfixed with an f, as in 2. 1f.
24%
Flag icon
in Java 1 and true are not related in any way, just as 0 and false are not related.
26%
Flag icon
The exam creators are fond of inserting the assignment operator = in the middle of an expression and using the value of the assignment as part of a more complex expression.
Prashant Kumar Rai
Exam Alert
26%
Flag icon
The first four relational operators (see Table 2.3) are applied to numeric primitive data types only.
26%
Flag icon
Table 2.4 Relational instanceof operator
26%
Flag icon
exam, as questions are known to alter a variable on the right-hand side of the expression that may never be reached. For
Prashant Kumar Rai
Exam Alert
26%
Flag icon
Comparing two numeric primitive types. If the numeric values are of different data types, the values are automatically promoted as previously described. For
27%
Flag icon
The exam creators also have a habit of mixing assignment operators and equality operators, as in the following
Prashant Kumar Rai
Exam Alert
27%
Flag icon
Two references are equal if and only if they point to the same object, or both point to null.
28%
Flag icon
exam, be wary of any question that includes a ternary expression in which a variable is modified in one of the right-hand side expressions.
Prashant Kumar Rai
Exam Alert
28%
Flag icon
Data types supported by switch statements include the following: byte and Byte short and Short char and Character int and Integer String enum values For the exam, we recommend you memorize this list. Note that boolean and long, and their associated wrapper classes, are not supported by switch statements.
Prashant Kumar Rai
Exam Alert
28%
Flag icon
The values in each case statement must be compile-time constant values of the same data type as the switch value.
29%
Flag icon
default block, it is only branched to if there is no matching case value for the switch statement, regardless of its position within the switch statement.
29%
Flag icon
return statement, like a break statement, can be used to exit the switch statement early.
30%
Flag icon
The initialization and update sections may contain multiple statements, separated by commas.
30%
Flag icon
Note that the semicolons separating the three sections are required, as for( ; ) and for( ) will not compile.
31%
Flag icon
Prashant Kumar Rai
Exam Alert
31%
Flag icon
When you see a for-each loop on the exam, make sure the right-hand side is an array or Iterable object and the left-hand side has a matching type.
Prashant Kumar Rai
Exam Alert
31%
Flag icon
Why will the following fail to compile?
Prashant Kumar Rai
Read tge question properly
31%
Flag icon
In and of itself, that will not cause the code to not compile, as a corrected loop would just output null three times.
32%
Flag icon
The optional label parameter allows us to break out of a higher level outer loop.
34%
Flag icon
Prashant Kumar Rai
B
35%
Flag icon
What is the output of the following code snippet?
36%
Flag icon
use numeric addition if two numbers are involved, use concatenation otherwise, and evaluate from left to right.
36%
Flag icon
Mutable is another word for changeable.
36%
Flag icon
On the OCA exam, you need to know that String is immutable.
36%
Flag icon
Also, immutable classes in Java are final, and subclasses can't add mutable behavior.
36%
Flag icon
The string pool, also known as the intern pool, is a location in the Java virtual machine (JVM) that collects all these strings.
36%
Flag icon
The string pool contains literal values that appear in your program.
36%
Flag icon
int length()
36%
Flag icon
char charAt(int index)
37%
Flag icon
int indexOf(int ch) int indexOf(int ch, int fromIndex) int indexOf(String str) int indexOf(String str, int fromIndex)
37%
Flag icon
Notice we said “stop at” rather than “include.”
37%
Flag icon
beginIndex, int endIndex)
37%
Flag icon
Since we start and end with the same index, there are no characters in between.
37%
Flag icon
String
« Prev 1 3