O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
Génération de l'aperçu...
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.
Description
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
Résumé IA
- Nom du document
- O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Contenu
- 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.
- Table des matières
- Agenda
- Announcements
- Review: OOP and Static vs Non-Static
- Worksheet #2
- Review: Arrays
- Worksheet #3 and #4
- Worksheet #1
- Pages
- 17 pages
- Téléversé par
- Uni24h
Foire aux questions
Ce document est-il gratuit ?
Oui. « O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou » est gratuit — il suffit de vous connecter et de cliquer sur Télécharger pour obtenir le fichier original.
Combien de pages compte ce document ?
Le document contient 17 pages, pour le cours Lập trình Java. Vous pouvez le prévisualiser en ligne avant de le télécharger.
Puis-je prévisualiser avant de télécharger ?
Oui. Vous pouvez prévisualiser ce document directement sur cette page avec le lecteur en ligne, puis décider de le télécharger ou non.
O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
Génération de l'aperçu...
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
Lire le document entier
- Nom du document
- O, b, j, e, c, t, s (Discussion 3) (Lập trình hướng đối tượng trong Java) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Contenu
- 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.
- Table des matières
- Agenda
- Announcements
- Review: OOP and Static vs Non-Static
- Worksheet #2
- Review: Arrays
- Worksheet #3 and #4
- Worksheet #1
- Pages
- 17 pages
- Téléversé par
- Uni24h
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !
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
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !