Berkeley CS 61B (one—overview/two—compliation)
暑期在家给自己安排了一些课程,这是第一部分——Berkeley CS61B
CS61B涉及到数据结构,算法,还有面向对象编程java的相关内容,本专栏主要记录一些自己不熟悉以及认为重要的关键知识。
one:java
java is an object oriented language with strict requirements:
1:every java file must contain a class declaration
2:all code lives inside a class
3:to run a java program, you should define a main method using
(**public static void main(String [] args) **)
java is statically typed
1:all variables(变量)parameter(参量),and methods must have a declared type.
2:The type can never change.
3:Expressions(表达式) also have a type.
4:before the program runs, the compile will check all the types in you program are compatible.
java’s advantages and disadvantages
Not elaborated here
two:compilation
javac=compile,java=run
there:Defining and instantiating classes
to run a program we must define a main method