String
String is a Java type that represents a string of characters (text).
String Literals
A sequence of characters enclosed in double quotations “ “.
Java Main Skeletons
Includes the class and main method arguments. Must include both in order to run successfully.
public static void main(String args[])
Main method. Code to be run must be placed within the main method.
public class MyProgram
Class. The name of MyProgram must match the name of the file.
System.out.print
Displays output on the computer monitor.
System.out.println
Displays output on the computer monitor and moves cursor to next line.
Variable
A symbol or container that holds a value.
int
int
is a Java type that represents an integer (a whole number).
char
char
is a Java type that represents a single character (a single letter).
double
double
is a Java type that represents a real number with decimal values
Declare a variable
Declaring a variable is defining it for the first time.
Initialize a variable
Initializing a variable is giving it an initial value, or a starting value.
Primitive Type
Primitive types are the basic, simple data types that are inherent to Java (int, double, char, and boolean).
Boolean
A boolean is a true or false value.
Reference Type
Reference variables store the address of the value.
final
Prevents variables from changing value.
Modulus operator
The modulus operator (written as % in most programming languages) divides two numbers and returns the remainder.
Integer Division
When two integers are divided, the decimal values are truncated, or chopped off.
Order of Operations
The order in which mathematical expressions should be evaluated. Starts with Parentheses, Exponents, Multiplications and Division, Addition and Subtraction.
Literal
The fixed value being assigned to a variable. Often primitive data types.
ArithmeticException
Exception that is thrown to warn programmers about arithmetic errors in their code.
Increment
Increase the value of a variable by one. variable++;
Decrement
Decrease the value of a variable by one. variable–;
Compound Assignment Operators
Allows programmers to shortcut variable assignments that include the variable being assigned a new value: x = x + y; shortcut: x += y;