-
// or Double Dash:
Marks the beginning of a comment.
-
( ) or Opening and Closing parenthesis:
Used in a Method Header.
-
{ } or Opening and Closing braces:
Encloses a group of statements, such as the contents of a Class or a Method.
-
" " or Quotation Marks:
Encloses a string of characters, such as a message that is to be printed on the screen.
-
; or Semicolon:
Marks the end of a complete programming statement.
-
All Java source code filenames must end with:
a .java extension.
-
Every Java application program must have:
a method named main.
-
Java is a case-sensitive language, it:
DOES NOT regard uppercase letters as being the same as their lowercase equivalents.
-
All Java programs must be stored in a file with a name:
that ends with .java.
-
Comments are ignored by:
the compiler.
-
A .java file may contain many classes but may only have:
one public class that must have the same name as the file.
-
Statements are terminated with semicolons, this does not include:
comments, class headers, method headers, or braces.
-
API stands for:
Application Programmer Interface.
-
The API is:
a standard library of prewritten classes for performing specific operations.
-
\n or Newline:
Advances the cursor to the next line for subsequent printing.
-
\t or Horizontal tab:
Causes the cursor to skip over to the next tab stop.
-
\b or Backspace:
Causes the cursor to back up, or move left, one position.
-
\r or Return:
Causes the cursor to go to the beginning of the current line, NOT the next line.
-
\\ or Backslash:
Causes a backslash to be printed.
-
\' or Single Quote:
Causes a single quotation mark to be printed.
-
\" or Double Quote:
Causes a double quotation mark to be printed.
-
A Variable is:
A named storage location in the computer's memory,
-
A Literal is:
A value that is written into the code of a program commonly assigned to variables or displayed.
-
A Variable Declaration or Name:
tells the computer the variable's name and the type of data it will hold.
-
An Identifier is:
A programmer-defined name that represents some element of a program (i.e. variable names and class names).
-
Key Words are:
words that have a special meaning in the programming language and used for their intended purpose only. Key Words are also known as Reserved Words.
-
Specific rules for Identifiers:
- -first character must be a-z, A-Z, underscore, or a dollar sign.
- -after first character, you may use a-z, A-Z, 0-9, underscores, or dollar signs.
- -upper and lowercase character are distinct.
- -cannot include spaces.
-
Data Types and Size:
- byte = 1 byte
- short = 2 bytes
- int = 4 bytes
- long = 8 bytes
- float = 4 bytes
- double = 8 bytes
-
Data Types are called "primitive" because you cannot:
use them to create objects.
-
Primitive Data Types can only create:
variables and a variable can only be used to hold a single value.
-
Variables do not have:
attributes or methods.
-
What is the name of the variable whose content is read only and cannot be changed during the program's execution of the program.
Named constant.
-
Which Scanner class method reads an int?
nextInt()
-
All Java lines of code end with semicolons (true/false).
False.
-
Which of the following is not a primitive data type?
String.
-
A variable's scope is the part of the program that has access to the variable (true/false).
True.
-
Both character literals and string literals can be assigned to a char variable (true/false).
False.
-
The primitive data types only allow a(n) ________ to hold a single value.
Variable.
-
What will be displayed after the following statements have been executed?
final double x;
x = 54.3;
System.out.println("x = " + x );
Nothing, this is an error.
-
This is a value that is written into the code of a program.
Literal.
-
Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created (true/false).
True.
-
Named constants are initialized with a value, that value cannot be changed during the execution of the program (true/false).
True.
-
If the compiler encounters a statement that uses a variable before the variable is declared, an error will result (true/false).
True.
-
In Java the variable named One is the same as the variable named ONE (true/false).
False.
-
To display the output on the next line, you can use the println method or use this escape sequence in the print method.
\n
|
|