Java Reference
In-Depth Information
Use
&&
and
||
for logical operations;
&
and
|
do not short-circuit.
4.
The
else
clause matches the closest dangling
if
. It is common to forget to
include the braces needed to match the
else
to a distant dangling
if
.
5.
When a
switch
statement is used, it is common to forget the
break
statement
between logical cases. If it is forgotten, control passes through to the next
case; generally, this is not the desired behavior.
6.
Escape sequences begin with the backslash
\
, not the forward slash
/
.
7.
Mismatched braces may give misleading answers. Use
Balance
, described
in Section 11.1, to check if this is the cause of a compiler error message.
8.
The name of the Java source file must match the name of the class being
compiled.
9.
Following are the available files for this chapter. Everything is self-contained,
and nothing is used later in the text.
FirstProgram.java
The first program, as shown in Figure 1.1.
OperatorTest.java
Demonstration of various operators, as shown in
Figure 1.3.
MinTest.java
Illustration of methods, as shown in Figure 1.6.
IN SHORT
1.1
What extensions are used for Java source and compiled files?
1.2
Describe the three kinds of comments used in Java programs.
What are the eight primitive types in Java?
1.3
1.4
What is the difference between the
*
and
*=
operators?
Explain the difference between the prefix and postfix increment
operators.
1.5
1.6
Describe the three types of loops in Java.
Describe all the uses of a
break
statement. What is a labeled
break
statement?
1.7
1.8
What does the
continue
statement do?
What is method overloading?
1.9
1.10
Describe call-by-value.
Search WWH ::
Custom Search