Day 2 Flashcards

1
Q

What does it mean to initialize a variable?

A

It means giving a value to that variable

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

Are constants variables or not?
How to define it?

A

• Yes. It’s a variable whose value can not be changed.
• “Final” keyword is used to define a constant.

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

What’s the preferred convention used to name a constant?

A

We use Snake case convention where all words are in upper case and between each word we put an underscore.

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

What’s an identifier in java?

A

It’s the naming. Generally any naming for classes, methods & variables. There are naming rules for identifiers.

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

What are the only special characters allowed for identifiers?

A

$ dollar sign
_ underscore

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

Which of these identifiers are correct according to rules?
1. Carrot6Piece
2. $diana
3. sad bitch
4. 2002best_year

A

1 & 2 are correct. Numbers are allowed within the identifier but not at the beginning

3 & 4 are wrong.
3. No spaces are allowed
4. Numbers are not allowed at the start of a name.

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

What’s the difference between the following?
“@”
‘7’

A

”@” is a String.
‘7’ is a character. Character is a type of data.

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

What type of data is True or False?

A

They are Booleans

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

What type of data is a class?

A

Calsses can be considered of “User Defined Type” in which a programmer create their own data type.

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