CS Primitive Types

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

1/21

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

22 Terms

1
New cards

primitive type

a basic data type that Java predefines.
- takes up different amounts of memory

2
New cards

Object reference type

Only need enough memory to hold a pointer to the object in question
- Declared with either a name of an interface or a class

3
New cards

8 primitive types (in order)

byte, short, int, long, float, double, char, boolean

4
New cards

Byte

(byte) 8 bits of interger

5
New cards

Short

(short) 16 bits of interger

6
New cards

Interger

(int) 32 bits of interger

7
New cards

Long

(long) 64 bits of interger

8
New cards

Float

(float) 32 bits of floating point

9
New cards

Double

(double) 64 bits of floating point

10
New cards

Character

(char) 16 bits of a letter

11
New cards

Boolean

(boolean) true or false

12
New cards

Variables

Fields of memory inside an object
- Can only hold one type of thing
- type, name
- Each variable can be seen by as few things as possible for as short a period of possible

13
New cards

Private declaration

Only seen inside the class

14
New cards

Protected declaration

Only seen in the class, package, and subclasses

15
New cards

Public declaration

Visible to all

16
New cards

Method

Declared with a return type, a name, and a list of parameters
- Each parameter is declared with a type and a name

17
New cards

Constructor method

Method that creates a new instance of a class
- Two kinds (object constructor and arrary object constructor)
- Always begins with the word new

18
New cards

Object constructor

Method that has the same name as the class and no declared return type

19
New cards

Array object constructor

Not a method we write, but we must specify that kind of thing the array holds and how many of that items are in said array

20
New cards

Array

A sequence of values of a given type.
-An object w/ a fixed size once it is created
- [array]

21
New cards

Examples of how arrays can e made (two)

- int[ ] myArray = we int[9]; (nine element arry of ints)
- int[ ] myArray = { 1, 1, 2, 5, 8, 13, 21, 34}; (nine element array w/ specific values)

22
New cards

Two dimensional array

An array of arrays
carton = new Egg[2][6];
for(int row = 0; row < carton.length; ++row){
carton[row][column] = we Egg();
}