Module 1: Basics Flashcards
What is a statement?
A line of code used to perform a task, it must end with a semicolon.
Ex:
{System.out.println(“This is a statement”);
What is the starting point of a java program?
The main method.
public static void main(String[] args) {}
What are the variable types?
String (Text)
byte (Whole numbers to 127)
int (Whole numbers to 2147483647)
short (Whole numbers to 32767)
long (Whole numbers to 9223372036854775807) add L after value.
double (Decimals) [Slower, More memory but more precise]
float (Decimals) [Faster, Less memory but not as accurate] add f after value.
char (Single character) requires single quotes.
boolean (True or false)
What is a comment?
Annotations of what the code is doing, they are not executed.
Ex:
// Single line comment
/* Multi line
comment */
What is scope?
Variables can only be used after the line they were created in, not above. If a variable was created in a code block, it cannot be used once the block ends.