Variables Flashcards
What are primitive data types?
Types of data built into the Java system
What are the 3 main primitive data types?
int
(integer), double
, boolean
What is an int data type?
int
(integer) is a primitive data type that holds positive numbers, negative numbers and zero
Which data type holds decimals?
the double
data type can hold decimals as well as large/small numbers
What is a boolean?
A primitive data type that references one of two values; either true or false
Which data type holds single characters?
char
(character); will hold any character like a letter, space or punctuation mark.
Surrounded by single quotes (' ')
What is a String literal?
Any sequence of characters enclosed in double-quotes
How do you add quotation marks to a String value?
The \"
escape sequence
example: System.out.println("\"Hello World\"");
Prints: “Hello World”
What does the the \\
escape sequence do?
Allows us to place a backslash in our String text
example: System.out.println("This is a backslash symbol: \\");
Prints: This is a backslash symbol: \
What escape sequence do we use to print a new line of text?
/n
Ex: System.out.println("Hello/nGoodbye)";
Prints:
Hello
Goodbye
What are static checks used for?
To help catch bugs during programming rather than during the execution of code