CS61B Data Structures, UCB(1)
Primitive Types
Each Java type has a different way to interpret the bits:
eg. 72 stored as 01001000
Letter H stored as 01001000
primitive types in Java
- byte
- short
- int
- long
- float
- double
- boolean
- char
Declaring a Variable
When you declare a variable of a certain type in Java:
- Your computer sets aside exactly enough bits to hold a thing of that type.
- Java creates an internal table that maps each variable name to a location.
- Java does NOT write anything into the reserved boxes.
The Golden Rule of Equals
Given variables y and x:
- y = x copies

这篇博客主要讲解了UCB的CS61B Data Structures课程中关于Java的数据类型。它区分了原始类型(如byte、int、char等)和引用类型,详细阐述了变量声明、赋值操作(等于号的含义)、类实例化、引用类型变量声明以及参数传递的过程。此外,还讨论了数组与IntList等链式数据结构的区别,强调数组大小固定而列表可以动态增长。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



