参数分为形式参数和实际参数**。例如:html
public setFacevalue(数据类型 形式参数) facevalue=形式参数~~即实际参数~~
构造方法与常规方法相似,它是辅助类的实例。经常使用于初始化与每一个对象有关的变量。除此以外,得注意:java
- 构造方法名与类名相同。
2.构造方法不能有返回值,所以方法声明首部没有返回值类型。
问题1解决方案:git
1. 类是一个抽象的概念,它不存在于现实中的时间/空间里,类只是为全部的对象定义了抽象的属性与行为。就好像“Person(人)”这个类,它虽然能够包含不少个 体,但它自己不存在于现实世界上。 2. 对象是类的一个具体。它是一个实实在在存在的东西。 3. 类是一个静态的概念,类自己不携带任何数据。当没有为类建立任何对象时,类自己不存在于内存空间中。 4.对象是一个动态的概念。每个对象都存在着有别于其它对象的属于本身的独特的属性和行为。对象的属性能够随着它本身的行为而发生改变。
问题2解决方案:小程序
问题3解决方案:变量分为全局变量和局部变量。它们的做用域不一样。vim
- 全局变量:在类里定义(非方法里)的变量,那么在这个类中均可以使用。
- 局部变量:在方法中定义的变量,这个变量一旦出了这个方法,就不能用了。
问题7解决方案:数据结构
问题1解决方案:app
rm
。以后从新作,不过复制就行。问题3解决方案:方法的返回值类型必须与方法首部中规定的返回值类型一致。当方法不返回任何值时,用void做为返回值类型,此时就不须要返回语句。less
问题4解决方案:将double数据类型变成String型编辑器
问题5:
-问题5解决方案:对此类问题总结,分为三种:ide
1.环境变量没有设置:JAVA_HOME、CLASSPATH、PATH,都须要指向JDK相关的目录,其中的JAVA_HOME指向安装根目录,CLASSPATH指向lib目录,path指向bin目录;
2.输入的JAVA源文件没有带文件名后缀java;
3.输入的JAVA源文件的名字与真实源文件不一致,须要注意的是大小写也必须一致。
问题7解决方案:出现这种状况是由于运用compareTo方法时:r1.compareTo(5/3); 其中若是想用数字5/3就得封装!!
RationalNumber num1; RationalNumber num2=5/3; num1 = num2;
错题1及缘由,理解状况:
If two variables contain aliases of the same object then
A . the object may be modified using either alias
B . the object cannot be modified unless there's but a single reference to it
C . a third alias is created if/when the object is modified
D . the object will become an "orphan" if both variables are set to null
E . answers A and D are correct
正确答案:E 个人答案:A
错误缘由:选项没有看完,致使没有选D。
错题2及缘由,理解状况
What happens if you attempt to use a variable before it has been initialized?
A . A syntax error may be generated by the compiler
B . A runtime error may occur during execution
C . A "garbage" or "uninitialized" value will be used in the computation
D . A value of zero is used if a variable has not been initialized
E . Answers A and B are correct
正确答案:E 个人答案:B
错误缘由:没有正确的认识语法错误,语法错误就是编辑时的错误,俗称病句。
错题3及缘由,理解状况:
What is the function of the dot operator?
A . It serves to separate the integer portion from the fractional portion of a floating point number
B . It allows one to access the data within an object when given a reference to the object
C . It allows one to invoke a method within an object when given a reference to the object
D . It is used to terminate commands (much as a period terminates a sentence in English)
E . Both B and C are correct
正确答案:E 个人答案:B
错误缘由:在课本上只看到了C的相关语句,因此直接选了C
错题4及缘由,理解状况:
Consider the following two lines of code. What can you say about s1 and s2?!
String s1 = "testing" + "123";
String s2 = new String("testing 123");
A . s1 and s2 are both references to the same String object
B . the line declaring s2 is legal Java; the line declaring s1 will produce a syntax error
C . s1 and s2 are both references to different String objects
D . s1 and s2 will compare "equal"
E . none of the above
正确答案:C 个人答案:B
错误分析:觉得S1是错误的语法,后来才发现没有问题。回去后直接试了下发现它们都是对的。
错题5及缘由,理解状况:
The String class' compareTo method
A . compares two string in a case-independent manner
B . yields true or false
C . yields 0 if the two strings are identical
D . returns 1 if the first string comes lexically before the second string
E . none of the above
正确答案:C 个人答案:D
错误分析:没有正确理解题目的意思,个人理解为:“class”与“method”相比。题目的意思为:“使用String类char compareTo()方法的输出。输出规则是:按照字典顺序+0-分别表示先于、等于、后于STr字符串。
这章比起前面几章难了很多,不少都一开始的时候都不能理解。在看例子的时候须要很是认真,时常须要问本身它为何这么作?不过学会或者是打出本身的一个小程序时,心中仍是特别高兴的。
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 075/000 | 1/1 | 05/20 | |
第二周 | 485/560 | 1/2 | 13/38 | |
第三周 | 412/987 | 1/4 | 21/60 | |
第四周 | 679/1666 | 1/5 | 21/90 |
1.Java语言中的错误
2.Java中的类与对象的区分
3.将double型变成String型
4.vim中的复制与粘贴
5.IDEA快捷键