从上个月开始了CS61B(伯克利大学的一门计算机课程),这次是我上课的笔记和自己犯错的地方
Argument等于参数,constructor主要是为了能让这个class跑起来,英文就是initialize the class.
做好一个function之后无法return
这里还是出现了之前的问题,就是无法把自己的结果给出来。
参考MaxArray这里的想法,哦哦哦!!!
我居然把windowPosSum 设置成了integer,这能不在反馈的时候出问题吗??
image.png
为什么return a 之后这里无法
Notes
-
Functions must be declared as part of a class in java.
A function that is part of a class is called a "method". -
To define a function in Java we use "public static".
-
All
class is like a file in java, it is used to get a results or called upon a function.
A member of a class is the variables and methods(functions) in the class.
member of a class are accessed using dot notation. For example, d.makenoise is calling "makenoise" method in "d" class
网友评论