O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
Đang tạo bản xem trước...
Tài liệu tóm tắt nội dung thảo luận về lập trình hướng đối tượng trong Java, bao gồm ôn tập static và non-static, mảng và các bài tập thực hành.
Mô tả
Discussion 3: {O, b, j, e, c, t, s} Christine Zhou Agenda Announcements Review: OOP and Static vs Non-Static Worksheet #2 Review: Arrays Worksheet #3 and #4 Worksheet #1 Announcements Project 0: 2048 is due 9/18, next Monday! Lab this week will partially be about the project HW2 is out and due 9/22, next Friday Get started early! Midterm 1 Conflict Form on Piazza due 9/15, this Friday MT1 is Wednesday, Sept 27 8-10PM Discussion survey: tinyurl.com/czdisc3 Review: Object Oriented Programming Class: define characteristics and behaviors of our object, act as a blueprint/template for our objects Can create instances of the object by using the constructor and the new keyword Human h = new Human(“Bob”, 1) “this” refers to the object that you are creating, like “self” in Python! public class Human { String name; int age; static int population; public Human(String name, int age) { this.name = name; this.age = age; population += 1; } public void greet() { System.out.println(“Hi! I’m ” + this.name) } public static void getPopulation() { System.out.println(population); } } Review: Object Oriented Programming Non-static (instance) variables and methods: Belong to the object itself Each person has their own name, age, and way to greet people Static (class) variables and methods: What is one static method that you’ve seen already? Belong to the class, no notion of “this” Preceded with “static” The “population” variable belongs to all Humans, not just one Human! public class Human { String name; int age; static int population; public Human(String name, int age) { this.name = name; this.age = age; population += 1; } public void greet() { System.out.println(“Hi! I’m ” + this.name) } public static void getPopulation() { System.out.println(population); } } Review: Object Oriented Programming Examples // In the Human class public class Human { public void testNonStatic(Human you) { greet(); this.greet(); you.greet(); Human.greet(); ge
Tóm tắt AI
- Tên tài liệu
- O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
- Trường / Môn
- University of California, Berkeley · Lập trình Java
- Nội dung
- Tài liệu này ôn lại các khái niệm cốt lõi của Lập trình hướng đối tượng như lớp, đối tượng, biến và phương thức tĩnh/không tĩnh, kèm theo các ví dụ minh họa và thông báo về bài tập, dự án.
- Mục lục
- Agenda
- Announcements
- Review: OOP and Static vs Non-Static
- Worksheet #2
- Review: Arrays
- Worksheet #3 and #4
- Worksheet #1
- Số trang
- 17 trang
- Người đăng
- Uni24h
Câu hỏi thường gặp
Tài liệu này có miễn phí không?
Có. “O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng 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 17 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ề.
O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
Đang tạo bản xem trước...
Discussion 3: {O, b, j, e, c, t, s} Christine Zhou Agenda Announcements Review: OOP and Static vs Non-Static Worksheet #2 Review: Arrays Worksheet #3 and #4 Worksheet #1 Announcements Project 0: 2048 is due 9/18, next Monday! Lab this week will partially be about the project HW2 is out and due 9/22, next Friday Get started early! Midterm 1 Conflict Form on Piazza due 9/15, this Friday MT1 is Wednesday, Sept 27 8-10PM Discussion survey: tinyurl.com/czdisc3 Review: Object Oriented Programming Class: define characteristics and behaviors of our object, act as a blueprint/template for our objects Can create instances of the object by using the constructor and the new keyword Human h = new Human(“Bob”, 1) “this” refers to the object that you are creating, like “self” in Python! public class Human { String name; int age; static int population; public Human(String name, int age) { this.name = name; this.age = age; population += 1; } public void greet() { System.out.println(“Hi! I’m ” + this.name) } public static void getPopulation() { System.out.println(population); } } Review: Object Oriented Programming Non-static (instance) variables and methods: Belong to the object itself Each person has their own name, age, and way to greet people Static (class) variables and methods: What is one static method that you’ve seen already? Belong to the class, no notion of “this” Preceded with “static” The “population” variable belongs to all Humans, not just one Human! public class Human { String name; int age; static int population; public Human(String name, int age) { this.name = name; this.age = age; population += 1; } public void greet() { System.out.println(“Hi! I’m ” + this.name) } public static void getPopulation() { System.out.println(population); } } Review: Object Oriented Programming Examples // In the Human class public class Human { public void testNonStatic(Human you) { greet(); this.greet(); you.greet(); Human.greet(); ge
Đọc toàn bộ tài liệu
- Tên tài liệu
- O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
- Trường / Môn
- University of California, Berkeley · Lập trình Java
- Nội dung
- Tài liệu này ôn lại các khái niệm cốt lõi của Lập trình hướng đối tượng như lớp, đối tượng, biến và phương thức tĩnh/không tĩnh, kèm theo các ví dụ minh họa và thông báo về bài tập, dự án.
- Mục lục
- Agenda
- Announcements
- Review: OOP and Static vs Non-Static
- Worksheet #2
- Review: Arrays
- Worksheet #3 and #4
- Worksheet #1
- Số trang
- 17 trang
- Người đăng
- Uni24h
Bình luận (0)
Chưa có bình luận nào. Hãy là người đầu tiên!
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
Bình luận (0)
Chưa có bình luận nào. Hãy là người đầu tiên!