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
… Tải file gốc để đọc toàn bộ tài liệu.
- 문서명
- 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
- Doc.pages
- 15 페이지
- 업로더
- Giang Le
자주 묻는 질문
Tài liệu này có miễn phí không?
Có. “Scope, Pass by Value, Static (Discussion 2) (Phạm vi, truyền tham trị và từ khóa static trong Java) - Christine Zhou” miễn phí — bạn chỉ cần đăng nhập rồi bấm Tải xuống để lấy file gốc.
Tài liệu dài bao nhiêu trang?
Tài liệu gồm 15 trang, thuộc môn Lập trình Java. Bạn có thể xem trước online trước khi tải.
Tôi có thể xem trước trước khi tải không?
Có. Bạn xem trước tài liệu ngay trên trang này bằng trình đọc online, rồi quyết định tải về.

댓글 (0)
댓글이 없습니다. 첫 댓글을 남겨보세요!