Types
Data |
Java |
Python |
Whole Numbers |
int |
int |
Floating Point |
double |
float |
Boolean |
boolean |
bool |
Character |
char |
str* |
Strings |
String* |
str |
Classes (structs) are simply new types that group together these primitive types to store related data
Everything is a primitive
A class is a new type
Type Systems
- Static - type is specified at creation and a variable's type cannot change (Java)
- Dynamic - type depends on data currently stored, and a variable may store different types (Python)
Type Systems
- Strong - the computer can determine what type of data a variable stores at all times
(Java & Python)
- Weak - the computer cannot determine what type of data a variable stores (Assembly)
Java
Strong & Static
Python
Strong & Dynamic
we will use type annotations
to make Python more static