Lesson 5 Flashcards
A statement specifies one or more actions to be performed during the execution of a program. In Java, a
statement is one or more lines of code terminated by a semicolon (;).
Java Statements
In Java, statements can be combined to form a statement block. A block is formed by enclosing statements by
curly braces.
Java Blocks
used to add notes and documentation to source codes
Java Comments
used to add notes and documentation to source codes
Java Comments
There are three types of comments in Java
- Block comment
- Line comment
- JavaDoc Comment
It starts with a forward slash and asterisk (/) and ends with an asterisk and forward slash (/)
Block comment
Starts with two forward slashes (//) and ends at the end of the line the slashes appear on. If the
slashes are the first two characters, then the whole line is considered a comment
Line comment
It is used specifically to document classes, attributes, and methods. It starts with a forward
slash and two asterisks (/**). It ends with one asterisk and a forward slash (*/).
JavaDoc Comment
are words that are used by the programmers to properly identify or name a class, procedure, method,
or variables.
Java Identifiers
rules on how to name an identifier
- alphabetic characters, both upper and lowercase (a-z and A-Z), numbers (0-9), underscores (_), and dollar sign ($).
- cannot start with a number.
- keywords (reserved words) cannot be used
is a fixed set of symbols built into the syntax of the language
Java Keywords
are items in a program whose values do not change.
Java Literals
classification of literals in Java
- Integers (hexadecimal, decimal, octal)
- Floating point numbers
- Booleans (true or false)
- Characters
- Strings
Represent different sets of data values and determine which standard operators can be applied.
Data types
are the building blocks and are an essential part of a program
Primitive Data Types
primitive data types supported by the Java programming language
- boolean (logical)
- char (for textual)
- byte
- short
- int
- long (integral)
- double
- float (floating point)
are places in memory that store values
Java Variables
are places in memory that store values
Java Variables
Two types of Variables
- Primitive Variables
- Reference Variables
These store data in the actual memory location of where the variable is.
Primitive Variables
They point to another
memory location where the actual data is.
Reference Variables
They point to another
memory location where the actual data is.
Reference Variables
refer to those whose value does not change
Constants