Java Reference
In-Depth Information
30.
Every statement in Java ends with a semicolon ( ; ), known as the statement terminator.
31.
Reserved words, or keywords, have a specific meaning to the compiler and cannot be
used for other purposes in the program.
32.
In Java, comments are preceded by two slashes ( // ) on a line, called a line comment, or
enclosed between /* and */ on one or several lines, called a block comment or para-
graph comment . Comments are ignored by the compiler.
33.
Java source programs are case sensitive.
34.
Programming errors can be categorized into three types: syntax errors , runtime errors ,
and logic errors. Errors reported by a compiler are called syntax errors or compile
errors. Runtime errors are errors that cause a program to terminate abnormally. Logic
errors occur when a program does not perform the way it was intended to.
Q UIZ
Answer the quiz for this chapter online at www.cs.armstrong.edu/liang/intro10e/quiz.html .
P ROGRAMMING E XERCISES
Note
Solutions to even-numbered programming exercises are on the Companion Website.
Solutions to all programming exercises are on the Instructor Resource Website.
Additional programming exercises with solutions are provided to the instructors on the
Instructor Resource Website. The level of difficulty is rated easy (no star), moderate ( * ),
hard ( ** ), or challenging ( *** ).
level of difficulty
1.1
( Display three messages ) Write a program that displays Welcome to Java ,
Welcome to Computer Science , and Programming is fun .
1.2
( Display five messages ) Write a program that displays Welcome to Java five times.
* 1.3
( Display a pattern ) Write a program that displays the following pattern:
J A V V A
J A A V V A A
J J AAAAA V V AAAAA
J J A A V A A
1.4
( Print a table ) Write a program that displays the following table:
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64
1.5
( Compute expressions ) Write a program that displays the result of
9.5
*
-
*
4.5
2.5
3
.
-
45.5
3.5
1.6
( Summation of a series ) Write a program that displays the result of
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9.
 
Search WWH ::




Custom Search