Week 12 Java Architecture
Week 12 Java Architecture
ARCHITECTURE
WEEK 12
WEEK 12
JAVA ARCHITECTURE
After completing this module, students are expected to:
Comments,
Identifiers and
Keywords
This section introduces the different types of
comments, identifiers and Java reserved
keywords that you should keep in mind when
writing Java programs.
WEEK 12
// comment
- Example:
/* comment */
Example
/*
This program is designed to initialize three score variable and get the
average of the score.
*/
WEEK 12
/** comment */
Example:
/**
*The 3 Test Average Program Computes
*The Average of 3 scores.
*@author Archer Chapswick
*@version 1.0 12/05/2016
*/
WEEK 12
Separators
- Java uses the following separators or punctuators to divide code into
segments.
- ( ) Parentheses. Used in control statements and parameter list in a
method.
- { } Curly Braces. These are used to define the scope of Java code,
class and methods.
- [ ] Square Brackets. Used in array declaration.
- ; Semicolon. Used to terminate a Java statement.
- , Comma. Used in method parameter list and variables declared
in a single line.
- . Period. Used in package name and class name and in separating
a variable or method from its instance or object.
WEEK 12
Examples:
float ceilingGrade = 100.0;
double piValue = 3.141516;
WEEK 12
Examples:
\r Carriage return
\f Formfeed
\\ Backslash
\’ Single quotation
\” Double quotation
WEEK 12
Example:
boolean canFit = numPeople >= 10;
boolean cannotFit = false;