这是一个新的专栏,记录我自学Berkeley CS 61B的笔记,作业等等。CS 61B作为CS入门的神课,会涉及到面向对象编程java和数据结构两方面的知识,笔者将会记录课程的关键知识,希望对你会有所帮助。
课程视频: https://www.bilibili.com/video/BV18x411L7yy
Professor: Jonathan Shewchuk
课程链接: https://people.eecs.berkeley.edu/~jrs/61b/
课程作业: https://github.com/Hao-Wang-Henry/Berkeley-CS61B
---------------------------这是分割线---------------------------
Lecture1 Course overview, Using objects
文章目录
Goals of CS 61B
- Learning efficient data structures and algorithms
- Designing and writing large programs
- Understanding and designing data abstraction and interfaces
- Learning java
Object Oriented Programming 概述
Object: A repository of data
Class: Type of object
Method: A class may inherit properties from a more general class
eg: ShoppingList inherits from List the property of storing a sequence of items.
Polymorphism: One method works on several classes, even if the classes need different implementations
eg: “addItem” method to every kind of list, although adding item to a shopping list is different from a shopping cart.
Objected-Oriented: Each object knows its class and methods
java String Object
Java在声明一个Object(如String)的时候,会构建一个Variable,这个Variable实际上有点类似于C++的指针,或者叫reference,他是会指向一个String Object,但是他本身并不是一个String Object,而只是一个指向String的Variable。
例如:
String myString