Java Data Types and Variable Operations

0.0(0)
studied byStudied by 0 people
0.0(0)
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/44

flashcard set

Earn XP

Description and Tags

These flashcards cover key terms and definitions related to Java's data types, variable declaration, and initialization concepts.

Last updated 1:54 PM on 2/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

45 Terms

1
New cards

No

Is $10.5$ valid for variable declared as int crayons;?

2
New cards

int and boolean

Types that are considered primitive in Java.

3
New cards

The semicolon after the data type is incorrect.

Syntax error in the declaration: double; price;.

4
New cards

Two (true and false)

Number of distinct values a boolean variable can hold.

5
New cards

char

Data type used to store a single character value.

6
New cards

int num; num = 5;

Two-statement equivalent for int num = 5;.

7
New cards

initialized

What variable names must be before they are used in Java.

8
New cards

Numbers with fractional parts (decimals)

What a double data type stores.

9
New cards

$2.0$

The value held by variable y after executing int x = 7; double y = 2.0; x = 14;.

10
New cards

TRUE

True or False: A final variable can be assigned a value exactly once.

11
New cards

String

Data type required to store the literal text 'robins egg blue'.

12
New cards

Primitive

Is char considered a primitive or a reference data type in Java?

13
New cards

Primitive

Is boolean considered a primitive or a reference data type in Java?

14
New cards

Primitive

Is double considered a primitive or a reference data type in Java?

15
New cards

Primitive

Is int considered a primitive or a reference data type in Java?

16
New cards

Variable Declaration

The process of defining a new variable by specifying its type and name.

17
New cards

Variable Initialization

The process of assigning a starting value to a previously declared variable.

18
New cards

The previous value is overwritten.

What happens to a variable's existing value when reassigned.

19
New cards

int

Numeric data type to use for counts that cannot have fractions.

20
New cards

It is missing the mandatory data type declaration.

Why myInteger = 100; is improper for first-time variable use.

21
New cards

It is missing a variable name.

Reason char = 'a'; is improper syntax.

22
New cards

It is initialized to $20$ and cannot be reassigned.

Status of variable z after executing final int z; z = 20;.

23
New cards

FALSE

Reference data types do not hold numeric primitive values directly.

24
New cards

reference

Variable type that stores a memory address to point to an object.

25
New cards

String

The non-primitive type among int, double, boolean, String.

26
New cards

TRUE

If boolean z = false; is followed by z = true;, what does z hold?

27
New cards

initialize

The act created by double price; that does not yet assign a value.

28
New cards

Yes

Can the whole number $42$ be successfully stored in an int variable?

29
New cards

No

Is the String value '10.5' compatible with an int variable?

30
New cards

Primitive data types

Category characterized by holding values directly in memory.

31
New cards

Primitive

Type defined by the declaration int x = 7;.

32
New cards

char

Specific Java keyword used for single character primitive type.

33
New cards

A semicolon (;)

What follows a variable declaration like double price to be correct.

34
New cards

A compilation error occurs.

Consequences of attempting to print a local variable that is not initialized.

35
New cards

boolean

Data type best for representing a simple toggle state like On/Off.

36
New cards

Reference type

Is String a built-in Java keyword or a reference type?

37
New cards

Yes

Can a final variable be declared first and then initialized later?

38
New cards

$5$

Value of x after executing int x = 10; x = 5;.

39
New cards

To declare a variable that reserves memory for a decimal number.

The primary function of the instruction double price; in Java.

40
New cards

int x = 5;

The valid declaration and initialization in Java.

41
New cards

$12$

The only valid value for an int among $12$, $12.0$, or '12'.

42
New cards

location

What reference types store about an object's memory.

43
New cards

TRUE

Is it possible to declare a variable in Java without giving it a value?

44
New cards

Primitive types

Category including int, double, and boolean.

45
New cards

A memory address

Type of data stored in the memory location of a reference variable.