Variables Flashcards

1
Q

What is a boolean data type?

A

In Java, a boolean data type is a primitive data type (pdt) used to store a value which could either be TRUE or FALSE. UNDERSTAND?!?!?

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

What is a String?

A

A String in Java is a Object that holds multiple characters. It is NOT a pdt.

Remember to store values between double quotes in a String.

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

How do you compare Strings?

A

You can use the equals() method to compare Strings. Do NOT use the primitive equality comparator “ == “ .

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

Some primitive data types?

A

int char boolean byte long short double float null…..

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

What is static typing?

A

In Java, the type of a variable is checked at compile time. This is known as static typing.

Advantage: catch errors at compile time rather than execution time.

Note: declare variables with the appropriate data type else program refuses to compile.

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

Compound assignment operators?

A

+= ×= ÷= –= /= %= .

Use: modify the value of a variable using one line of code.

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

What are control structures?

A

Control structures or statements allow programmers to determine the order in which a program is executed.

They allow for specificity. So one can skip some statements or lines of code while executing others. One can also repeat one or more statement while some condition is true.

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