Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou
正在生成预览...
Tài liệu thảo luận về phạm vi, truyền tham trị và từ khóa static trong Java, kèm ôn tập danh sách liên kết và sơ đồ box-and-pointer.
描述
Discussion 2: Scope, Pass-byValue, Static Christine Zhou Agenda Announcements Worksheet #1 Worksheet #2 Worksheet #3 (if we can!) Administrivia Lab 1 and Lab 2 due this Friday 2/1 at midnight. ○ Note, all labs are due Friday at midnight the week they are assigned. Proj0 NBody also due Friday at midnight. ○ If you haven’t started please start ASAP! Office hours and exam prep/LOST sections start this week! See calendars on the course website. Pre-semester Advising: @414 or email me! Discussion survey: http://tinyurl.com/cz-disc2-sp19 ○ Good for me to collect your emails (in case I have announcements or mess up during discussion 😅) Review: Defining classes // class definition public class IntList { // instance variables int head; IntList tail; // constructors, which will create IntList objects public IntList() {...} public IntList(int value, IntList tail) {...} // you can create methods that use the instance variables! public void insert(int val) {...} public void removeLast() {...} } Review: Java’s Types Primitives: References: byte, short, long, int, double, float, char, boolean Everything else! Objects, arrays, Strings, etc. Review: Box and Pointer Diagrams Box and Pointers are the 61B equivalent of 61A’s environment diagram They are crucial to helping us keep track of what goes on in a program: use them! int x = 29; int x 29 Primitives go in the box int[] arr = new int[3]; We didn’t specify what integers are going in the array, so Java initializes it with the default value 0 int[ ] arr 0 0 0 Reference types are referenced via pointers Java is pass by value Golden Rule of Equals AKA pass-by-value When you do “a = b”, you always copy the bits (whatever is inside the box) of b into a. For primitives: Directly copy the value inside b to a. For Reference types: Copy the memory address of b into a. ○ Also can say “copies the pointer in b to a” int[ ] arr1 int x = 29; int y = x; int x int y 29 29 int[] arr1 = new int
AI 摘要
- 文档名称
- Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu thảo luận về phạm vi, truyền tham trị và các thành phần tĩnh trong Java, kèm theo các ví dụ và bài tập thực hành về định nghĩa lớp, kiểu dữ liệu và cấu trúc dữ liệu IntList.
- 目录
- Agenda
- Announcements
- Administrivia
- Review: Defining classes
- Review: Java’s Types
- Review: Box and Pointer Diagrams
- Java is pass by value
- 1) Pass by What?
- Review: Static Variables/Methods
- 2) Static Methods and Variables
- Review: IntLists
- 3) Practice with Linked Lists
- 4) Extra: Squaring a List
- 页数
- 15 页
- 上传者
- Uni24h
常见问题
此文档免费吗?
是的。“Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 15 页,适用于课程 Lập trình Java。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。
Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou
正在生成预览...
Discussion 2: Scope, Pass-byValue, Static Christine Zhou Agenda Announcements Worksheet #1 Worksheet #2 Worksheet #3 (if we can!) Administrivia Lab 1 and Lab 2 due this Friday 2/1 at midnight. ○ Note, all labs are due Friday at midnight the week they are assigned. Proj0 NBody also due Friday at midnight. ○ If you haven’t started please start ASAP! Office hours and exam prep/LOST sections start this week! See calendars on the course website. Pre-semester Advising: @414 or email me! Discussion survey: http://tinyurl.com/cz-disc2-sp19 ○ Good for me to collect your emails (in case I have announcements or mess up during discussion 😅) Review: Defining classes // class definition public class IntList { // instance variables int head; IntList tail; // constructors, which will create IntList objects public IntList() {...} public IntList(int value, IntList tail) {...} // you can create methods that use the instance variables! public void insert(int val) {...} public void removeLast() {...} } Review: Java’s Types Primitives: References: byte, short, long, int, double, float, char, boolean Everything else! Objects, arrays, Strings, etc. Review: Box and Pointer Diagrams Box and Pointers are the 61B equivalent of 61A’s environment diagram They are crucial to helping us keep track of what goes on in a program: use them! int x = 29; int x 29 Primitives go in the box int[] arr = new int[3]; We didn’t specify what integers are going in the array, so Java initializes it with the default value 0 int[ ] arr 0 0 0 Reference types are referenced via pointers Java is pass by value Golden Rule of Equals AKA pass-by-value When you do “a = b”, you always copy the bits (whatever is inside the box) of b into a. For primitives: Directly copy the value inside b to a. For Reference types: Copy the memory address of b into a. ○ Also can say “copies the pointer in b to a” int[ ] arr1 int x = 29; int y = x; int x int y 29 29 int[] arr1 = new int
阅读全文
- 文档名称
- Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou
- 学校 / 课程
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu thảo luận về phạm vi, truyền tham trị và các thành phần tĩnh trong Java, kèm theo các ví dụ và bài tập thực hành về định nghĩa lớp, kiểu dữ liệu và cấu trúc dữ liệu IntList.
- 目录
- Agenda
- Announcements
- Administrivia
- Review: Defining classes
- Review: Java’s Types
- Review: Box and Pointer Diagrams
- Java is pass by value
- 1) Pass by What?
- Review: Static Variables/Methods
- 2) Static Methods and Variables
- Review: IntLists
- 3) Practice with Linked Lists
- 4) Extra: Squaring a List
- 页数
- 15 页
- 上传者
- Uni24h
评论 (0)
暂无评论。快来抢沙发吧!
Misc.onclusion (Discussion 14-END) (Ôn tập cấu trúc dữ liệu) - Christine Zhou
Final Review Solutions (Cấu trúc dữ liệu heap, hàng đợi ưu tiên và duyệt đồ thị) - Ching and Christines
Giáo trình Lập trình Java
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Asymptotic Analysis (Discussion 7) (Phân tích tiệm cận) - Christine Zhou
Chương 7.Cơ học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 6.Quang học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 5.Thuyết tương đối - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 4. Tán xạ ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 3.Phân cực ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
评论 (0)
暂无评论。快来抢沙发吧!