Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.
| Brooklyn College Library & Academic IT |CISC Department

CISC 3130 Data Structures: Primitive Data Types

Professor Chuang Spring 2020 OER


This section is meant to serve as a refresher. The bulk of this class will be covering ways of organizing data as collections of primitive data types.

Primitive data types are like the concept of atoms in biology. This is the most basic building block of all data structures - it defines the type of value captured. Primitive data types are built into just about all the mainstream programming languages and typically store a single value.

Under the hood, data is stored into memory as bits (1's and 0's). When you define a variable, you are assigning space to certain values. When you define a variable with the type, you're indicating to type of value organized. The memory can then be filled with data or state

Examples: integer, real, char, string.



Java Implementation

In Java, because it was designed as a statically-typed language, you must first declare variables (i.e. reserved names)  before the can be used. Statically-typed also means that you cannot change the type of value.

int i = 1;                 // defining an integer
int j;                       // reserving the name
String s = "Hello World!; // declaring a string value named s

Keep in mind that Java is sensitive to the scoping of variables. 

  • Variables declared in a method are not accessible by all class members.
  • Variables declared in a class are not accessible by all classes in a package;
  • Global variables are accessible across anywhere if access is generous enough (i.e. public variables).