Primitive Types

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

5 Terms

1
New cards
What is widening or automatic type conversion? (up casting) What is narrowing or explicit conversion? (down casting) During expressions?
This means you can convert from smaller data types to larger ones. It’s automatic because it can easily fit in the data type.

\
Ex. int y = 5;

double x = y; (X is bigger than y)

\
Downcasting means you convert larger data types to smaller ones. It’s explicit because you must be able to fit a larger one into a smaller one.

Ex. double x = 15432432;

int y = (int) x; (you must shrink x to fit into y)

\
Sometimes, an expression will result in a number larger than the data type can sustain. You will need to typecast it then

`        // Declaring byte array`

`        byte` `b = 50;`

 

`        // Type casting int to byte`

`        b = (byte)(b * 2);`

\
2
New cards
What is type promotion and why is it important?
It’s when a data type is unable to perform an operation in it’s current so it must promote itself to a different type to perform it.

\
Java automatically promotes each byte, short, or char operand to int when evaluating an expression.
It’s when a data type is unable to perform an operation in it’s current so it must promote itself to a different type to perform it.

\
Java automatically promotes each byte, short, or char operand to int when evaluating an expression.
3
New cards
How do you convert from binary to hexadecimal?
Split up the binary number into sets of 4 and write it that way.

\
You can also convert each letter in hexadecimal to binary by converting each letter in hexadecimal to a set of 4 binary number and combining it.
4
New cards
What is a final
A variable that won’t change.
5
New cards

Explore top flashcards

IPA Symbols
Updated 745d ago
flashcards Flashcards (48)
CISC vs RISC
Updated 701d ago
flashcards Flashcards (22)
collocation 12
Updated 254d ago
flashcards Flashcards (67)
3/22/24 - DNA exam
Updated 591d ago
flashcards Flashcards (25)
SCMA 350 Exam 1
Updated 974d ago
flashcards Flashcards (37)
IPA Symbols
Updated 745d ago
flashcards Flashcards (48)
CISC vs RISC
Updated 701d ago
flashcards Flashcards (22)
collocation 12
Updated 254d ago
flashcards Flashcards (67)
3/22/24 - DNA exam
Updated 591d ago
flashcards Flashcards (25)
SCMA 350 Exam 1
Updated 974d ago
flashcards Flashcards (37)