Study number 2016-2017-2 "Java program Design" The 3rd week study Summary textbook study content summary main content
- Class
- Construction method and object creation
- Basic structure of class and program
- Parameter Passing value
- Combination of objects
- Instance members and class members
- Method overloading
- this keyword
- Package
- Import statement
- Object array
The implementation of a class class consists of two parts: a class declaration and a class body. The basic format is:
Class Name {
The contents of the class body
}
The content of a class body is composed of two parts: the declaration of a variable, which is used to characterize the property, and the definition of the method used to characterize the behavior function. About methods
The definition of a method consists of two parts: a method declaration and a method body. The general format is:
方法声明部分 { 方法体的内容 } 1.方法声明部分(方法头)方法头由方法的类型、名称和名称之后的一对小括号以及其中的参数列表所构成。例如: int speak(){ //无参数的方法头 return 23; } int add(int x,int y,int z) //有参数的方法头 { return x+y+z; }
Note:
A variable of a member of a class is that a local variable is only valid within a method and is related to its declared location.
The action on a member variable can only be placed in a method, and the method may manipulate the member variable and the local variable declared in the method body.
Create an object that includes the declaration of an object and assigns a variable to an object two steps
Declaration of the object
The General format is:
类的名字 对象名字 如: XiyoujiRenwu zhubajie;
Assigning variables to Objects
egzhubajie=new xiyoujirenwu();
About mutable parametersThe last parameter must be the last parameter in the method's argument list.
Note: public void method (int ... x,int y)//variable parameter x is not the last argument of method, Y is the last argument
About passing values
When a parameter is a reference type, "pass value" passes a reference to the variable instead of the entity referenced by the variable. The reference data for Java includes objects, arrays, and interfaces.
Problems in teaching materials learning and the solving process
Issue 1, with package compilation, with package run problem.
Solution: You can put the relevant files in the same folder, and then run.
Problems in code debugging and the resolution process
Because the previous use is HTTPS
to enter the account password each time, so this time with the ssh
configuration of the process accidentally formatted the warehouse, resulting in a large number of files on the code cloud lost (fortunately, local files are still in), after the configuration succeeded SSJ re-upload the lost file code, But the code-hosting statistics error, do not know why, this week estimated to hit more than 800 lines of code it
Code Hosting
(run result of statistics.sh script)
Last week, the wrong question always
For <<
the error.
The solution, Baidu learned that the symbol is left to move the symbol, as long as the relevant digitization into the binary system left to move the operation.
Question 2, about break
p49 3 (2)
case
If there is no break, the program executes the following statement until it encounters a break;
Learning progress Bar
|
lines of code (new/cumulative) |
Blog Volume (Add/accumulate) |
Learning Time (new/cumulative) |
Important Growth |
Goal |
5000 rows |
30 Articles |
400 hours |
|
First week |
100/200 |
2/2 |
20/20 |
|
Second week |
300/200 |
2/4 |
18/38 |
|
Third week |
800/500 |
3/7 |
22/60 |
|
Week Four |
/1000 |
/9 |
/90 |
|
Resources
20165334 the third week of Java Program Design Study summary