public
private
等。Tostring
,return
这些基础的知识。形式参数是函数定义中的,系统没有为其分配内存空间,可是在定义里面可使用的参数。例如:fun(int a)。这里a就是形式参数。
实际参数是函数调用的时候传给函数的变量。这个是系统实实在在分配了内存空间的变量。
简单点说,就是形式参数给个形式,实际参数放进去用。例如:fun(a);
函数声明的用处是告诉编译器声明的函数在后面有定义。若是你将函数定义放在调用的前面,就不须要声明。另外声明就是函数定义后面加上分号的形式。
例如:定义是fun(int a)。声明就是fun(int a);
对于实验的解决方法就是
html
在学习第七章找到了这种问题的解决方法:在上述构造方法中,this引用特指对象的实例变量,赋值语句右边的变量是构造方法的形参变量。
这种方法避免了对含义相同的变量要给出不一样命名以示区别的问题。有时,这种状况发生在其余的方法中,但更常常出如今构造方法中。java
toString
方法,但在return时却一直报错,因而我就使用了多个toString方法,发现仍是有错误,最后才发现能够用“+”来拼接╥﹏╥在IDEA中想要上传文件到码云,却遇到了这个问题git
问题1解决方案:其实本身仍是不会使用IDEA来push和pull项目,有时成功有时又失败,(╥╯^╰╥)。程序员
问题2解决方案:课本有说过,每一个类都有一个不带参数的的默认构造方法。可是必需要实例化这个类(固然这不是惟一产生对象的途径,好比单例模式,但本质上说全部途径都是同样的)的时候,那么就要用到本身写的构造函数,即告诉程序我如今要实例化一个对象了,你给我立刻分配内存,将内存的首地址赋给我指定的类对象。编程
问题3的解决方案:老师对这个程序进行调试时,发现其中有一项一直输出空值,而后才发现是循环语句打错了(尚未学循环语句)。安全
错题一: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.可使用别名来修改对象
B.对象不能被修改除非有一个单独的引用
C.语言若是对象被修改,则会建立第三个别名。
D.若是两个变量都被设为null,那么这个对象就会变成一个“孤儿”
E.答案A和D是正确的
解析:在课本3.1.1中有解释,String对象一旦被建立就不可变,可是别名提供了一种能够修改对象的方法。根据定义若是两个变量都被设为null,那么这个对象就不会被任何变量引用(经过任何别名),它确实会变成一个“孤儿”,而且在未来的某个时候会被垃圾收集。数据结构
错题二:Which properties are true of String objects?
A . Their lengths never change
B . The shortest string has zero length
C . Individual characters within a String may be changed using the replace method
D . The index of the first character in a string is one
E . Only A and B are true
正确答案: E
解析:字符串是不可变的。这意味着,一旦建立了string对象,就不能更改它。字符串的长度在建立后不会发生改变。最短的长度字符串是"",因此长度是0。replace方法容许从原来的一个字符串中建立一个新的字符串,替换一些字符。字符串中第一个位置的索引是0,而不是1。另外,每一个字符串的最后一个字节包含字符串末尾字符,它是低值或二进制0的字节。app
错题三: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
解析:不少时候,编译器可以检测到未初始化的变量的尝试,在这种状况下它会产生一个语法错误。若是编译器使用逃逸检测,则在使用时出现运行时错误。Java是一种很是“安全”的语言,所以,若是在计算中使用未初始化的变量,则不容许使用“垃圾”或“零”。less
错题四:
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
解析: .
点操做符直接追加在对象引用以后,后面是须要访问的数据或方法。在数据的状况下,访问多是为了阅读或写做。在方法的状况下,访问是容许某人调用该方法。浮点数中的点是一个小数点而不是一个点算符。dom
错题五:In Java, "instantiation" means
A . noticing the first time something is used
B . creating a new object of the class
C . creating a new alias to an existing object
D . launching a method
E . none of the above
正确答案: B
你的答案: C
解析:“实例化”意味着建立对象的新实例。这一般是经过使用新操做符来完成的。在字符串的状况下,只需在表达式中使用引号,就能够建立新的实例(实例化)。例如:字符串年代;s="一个新字符串(实例)";
错题六:Say you write a program that makes use of the Random class, but you fail to include an import statement for java.util.Random (or java.util.). What will happen when you attempt to compile and run your program.
A . The program won't run, but it will compile with a warning about the missing class.
B . The program won't compile-you'll receive a syntax error about the missing class.
C . The program will compile, but you'll receive a warning about the missing class.
D . The program will encounter a runtime error when it attempts to access any member of the Random class
E . none of the above
正确答案: B
你的答案: A
假设您编写了一个程序,该程序使用了Random类,可是您没有包含java.util的import语句,(或java.util。)。当您试图编译并运行您的程序时将会发生什么。
A.这个程序不会运行,可是它将会对丢失的类发出警告。
B.程序不会编译,您将会收到关于丢失的类的语法错误。
C.程序将会编译,可是您会收到一个关于丢失的类的警告。
D.当程序试图访问随机类的任何成员时,程序将会遇到运行时错误
E.以上都不是缺乏的类意味着将会有未定义的变量和/或方法。编译器会检测到这些,并会发出错误消息。你的程序是不可执行的。
错因:仍是没有准确理解编译和进行的区别。
解析:缺乏的类意味着将会有未定义的变量和/或方法。编译器会检测到这些,并会发出错误消息。你的程序是不可执行的。
错题七:Which of the following will yield a pseudorandom number in the range [ -5, +5 ) given the following:
Random gen = new Random( );
A . gen.nextFloat( ) * 5
B . gen.nextFloat( ) * 10 - 5
C . gen.nextFloat( ) * 5 - 10
D . gen.nextInt( ) * 10 - 5
E . gen.nextInt(10) - 5
正确答案: B 个人答案: E
解析:gen.nextInt(10) - 5 所获得的结果是-5,-4,-3,-2,-1,0,1,2,3,4,并非题目中所要求的,它获得的只是一些数而不是一个取值范围。而nextFloat则是在范围[0,1)中产生伪随机数字;乘以10的收益率在0到10之间,再减去5,获得结果。
错题八: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 objects 1和s2都是对同一个字符串对象的引用
B . the line declaring s2 is legal Java; the line declaring s1 will produce a syntax error 声明s2的行是合法的Java;声明s1的行将产生一个语法错误
C . s1 and s2 are both references to different String objects s1和s2都是对不一样字符串对象的引用
D . s1 and s2 will compare "equal" s1和s2会比较"相等"
E . none of the above
正确答案: C
你的答案: A
错因:粗枝大叶,没有注意到二者细微的差异。
解析:这两个声明都是合法的Java。s1是一个字符串引用,它被初始化为字符串“testing123”。s2是一个字符串引用,它被初始化为字符串“测试123”。注意“测试”和“123”之间的空格。因此这两个字符串不相等。
错题九:
An "alias"(别名) is when
A . two different reference variables refer to the same physical object
B . two different numeric variables refer to the same physical object
C . two different numeric variables contain identical values
D . two variables have the same names
E . none of the above
正确答案: A
你的答案: B
解析:当有两个或多个对同一物理对象的引用时,就会出现“别名”,这样,经过遵循任一引用,就能够读/写/修改对象
错题十:
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
你的答案: E
解析:若是两个字符串是彻底一致的,那么它的值为0。
错题十一:
An API is
A . an Abstract Programming Interface(一个抽象的编程接口)
B . an Application Programmer's Interface(应用程序程序员的接口)
C . an Application Programming Interface(一个应用程序编程接口)
D . an Abstract Programmer's Interface(一个抽象的程序员的接口)
E . an Absolute Programming Interface(一个绝对的编程接口)
正确答案: C
你的答案: B
错因:没有理解好课本3.3.1
解析:API是一个应用程序编程接口,它是为特定目的而构建的相关类的集合。它们一般驻留在类库中。
错题十二:
The advantage(s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that(与数学相比,随机类的伪随机数生成器的优势是随机方法: )
A . you may create several random number generators(你能够建立几个随机数生成器)
B . the generators in Random are more efficient than the one in Math.random(随机产生的发电机比数学中的那个更有效率)
C . you can generate random ints, floats, and ints within a range(你能够在一个范围内生成随机的ints、浮点数和ints)
D . you can initialize and reinitialize Random generators(您能够初始化并从新初始化随机生成器)
E . all but answer B
正确答案: E
你的答案: C
错因:没有理解题目。
解析:全部随机数字生成器的效率是同样的。随机生成器优于数学的优势。随机包含全部其余属性。
错题十三:
The advantages of the DecimalFormat class compared with the NumberFormat class include(与NumberFormat类相比,十进制格式类的优势包括)
A . precise control over the number of digits to be displayed(精确控制要显示的数字的数量)
B . control over the presence of a leading zero(控制一个前导零的存在)
C . the ability to truncate values rather than to round them(语言可以截断值而不是绕过它们)
D . the ability to display a % automatically at the beginning of the display(在显示开始时自动显示“%”的能力)
E . only A and B
正确答案: E
你的答案: A
错因:没有详细比较二者的区别
解析:虽然十进制格式提供的控制比NumberFormat要多得多,可是经过一个或多个数学方法,截断仍然在程序员的手中“%”符号会出如今显示器的末端,而不是开始。
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 127/127 | 1/1 | 25/25 | |
第二周 | 278/405 | 1/2 | 20/45 | |
第三周 | 442/847 | 1/3 | 20/65 | |
第四周 | 1063/1910 | 2/5 | 30/95 |
在学第七章的时候碰见了不少的条件语句,也遇到了不少的问题,发现就算是照着课本打,有时也会出问题,由于你根本就没有理解这些数据的含义究竟是什么。因此咱们的学习不仅是简单照着书本上敲代码,更多的是要去理解他为何要这样敲,要从中去总结规律,这样才能更快更好的去掌握知识。我认为我要努力的方面还有不少,还要尽可能去使用网上的资源,而不是仅仅只看课本。