20182331 2019-2020-2,3《数据结构与面向对象程序设计》第2,3周学习总结

20182331 2019-2020-2,3《数据结构与面向对象程序设计》第2,3周学习总结html

1、教材学习内容总结
(一)、第二章学习总结:
1.字符串是由String类定义的对象
2.println输出后光标移动到下一行,print不会
3.变量常量及他们的赋值
4.基本数据类型,和C的没啥差距
5.5个算数运算符及其优先级和自增自减,赋值运算符
6.数据类型转换:赋值类型转换、提高类型转换、强制类型转换
7.Scanner类提供一些从不一样数据源读取各类类型数据的方法
(二)、第二章学习总结:
1.建立对象引用变量的声明与初始化以及别名的概念
2.String类对象的长度和内容不可修改
3.包:JAVA标准类库中的类,import声明
4.Random类用来生成随机数
5.Matn主要是基本数学函数,静态方法
6.NumberFormat和DecimalFormat格式化信息输出,printf输出含有数值的格式字符串
7.一个包装器表明一种具体的基本数据类型vim

2、教材学习中的问题和解决过程数据结构

问题1:静态方法和非静态方法有啥区别?
问题1解决方案:二者的生命周期不一样。静态方法的生命周期跟相应的类同样长。而非静态方法的生命周期和类的实例化对象同样长。静态方法能够直接调用,类名调用和对象调用。可是非静态方法只能经过对象调用。
问题2:Scanner scan = new Scanner(System.in)常常用可是它是啥意思?
问题2解决方案:调用Scanner类的方法,必须建立一个对象。Java中的对象使用new运算符来建立。dom

3、代码调试中的问题和解决过程函数

问题1:使用Scanner类输入数据时发生错误,提示InputMismatchException
问题1解决方案输入类型与方法不匹配,将输入语句修改为与变量类型对应就能够了
问题2::吃回车问题
问题2解决方案:当要输入字符或字符串时,若是前面不是字符或字符串类型的输入,那么就会出现吃回车问题,输入op=scan.nextLine(),将前者留在键盘缓冲区的回车吃掉学习

4、代码托管
设计

5、上周考试错题总结调试

1.If you want to output the text "hi there", including the quote marks, which of the following could do that? (若是你想输出文本"hi there",包括引号在内,下面哪一个语句能够作到?)
A . System.out.println("hi there");
B . System.out.println(""hi there"");
C . System.out.println(""hi there");
D . System.out.println(""hi there"");
E . none, it is not possible to output a quote mark because it is used to mark the beginning and ending of the String to be output (无,不可能输出引号,由于它被用来标记字符串的开始和结束)
缘由:”是一个转义序列,用于在字符串中放置引号,所以这里使用它来输出引号和字符串的其他分。
2.In order to compare int, float and double variables, you can use <, >, ==, !=, <=, >=, but to compare char and String variables, you must use compareTo( ), equals( ) and equalsIgnoreCase( ).
A . true
B . false
缘由:第一个我知道,但第二个和第三个我不知道
3.You cannot cast a String to be a char and you cannot cast a String which stores a number to be an int, float or double. (你不能将字符串强制转换为char类型,也不能将一个字符串强制转换为int、float或double类型。)
A . true
B . false
缘由:根据实验二输入加减运算符的推断作的,可是我没搞清转化和取第一个字符的区别
4.Which of the following is true regarding the mod operator, %? (关于求余运算符%,下面哪项是正确的?)
A . It can only be performed on int values and its result is a double (它只能执行int类型的数值,其结果是double类型的数)
B . It can only be performed on int values and its result is an int (它只能执行int类型的数值,其结果也是int类型的数)
C . It can only be performed on float or double values and its result is an int (它只能执行float或者double类型的数值,其结果是int类型的数)
D . It can only be performed on float or double values and its result is a double (它只能执行float或者double类型的数值,其结果是double类型的数)
E . It can be performed on any numeric values, and the result always is numeric (它能够执行任何类型的数值,其结果始终是数值)
5.What is output with the statement System.out.println(x+y); if x and y are int values where x=10 and y=5? (若是x和y是int类型的数值,x=10,y=5,那么语句System.out.println(x+y);的输出是什么?)
A . 15
B . 105
C . 10 5
D . x+y
E . An error since neither x nor y is a String (因x和y都不是字符串而引发的一个错误)
6.What is output with the statement System.out.println(""+x+y); if x and y are int values where x=10 and y=5? (若是x和y是int类型的数值,x=10,y=5,那么语句System.out.println(""+x+y);的输出是什么?)
A . 15
B . 105
C . 10 5
D . x+y
E . An error since neither x nor y is a String (因x和y都不是字符串而引发的一个错误)
7.If you want to store into the String name the value "George Bush", you would do which statement? (若是你想把"George Bush"这个值存储为字符串类型的名字,你会执行那条语句?)
A . String name = "George Bush";
B . String name = new String("George Bush");
C . String name = "George" + " " + "Bush";
D . String name = new String("George" + " " + "Bush");
缘由:四、五、六、7都是由于基础只是不扎实而作错的
其余没贴出来的错题一部分是重复问题,一部分是因为英语很差orm

6、结对互评
20182309 结对学习内容
结对学习内容:
重装Linux
替换vimrc
切换源
比较C语言和Java
帮助分析错误htm

董其鹏: 由于我两是上下铺的关系,因此咱们是一块儿学习,有问题一块儿查资料,一块儿解决,虽然他的基础很差,可是他学的十分努力,出了bug先是本身解决,解决不了在过来和我商量。

7、学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 729/838 2/4 47/67

《Java程序设计与数据结构教程(第二版)》

《Java程序设计与数据结构教程(第二版)》学习指导

相关文章
相关标签/搜索