Variables Flashcards

1
Q

What are primitive data types?

A

Types of data built into the Java system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 main primitive data types?

A

int (integer), double, boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an int data type?

A

int (integer) is a primitive data type that holds positive numbers, negative numbers and zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which data type holds decimals?

A

the double data type can hold decimals as well as large/small numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a boolean?

A

A primitive data type that references one of two values; either true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which data type holds single characters?

A

char (character); will hold any character like a letter, space or punctuation mark.

Surrounded by single quotes (' ')

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a String literal?

A

Any sequence of characters enclosed in double-quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you add quotation marks to a String value?

A

The \" escape sequence

example: System.out.println("\"Hello World\"");
Prints: “Hello World”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the the \\ escape sequence do?

A

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: \

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What escape sequence do we use to print a new line of text?

A

/n

Ex: System.out.println("Hello/nGoodbye)";
Prints:
Hello
Goodbye

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are static checks used for?

A

To help catch bugs during programming rather than during the execution of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly