1.进一步了解类与对象(类、属性、操做)。简单点理解就是好多个对象组成了一个类。
2.对于编写类的分析。(实例数据、封装、可见性修饰符、访问器和修改器)。
3.用来描述类的结构及类间的关系:UML类图。
4.方法的分析。(return语句、参数、局部数据、构造方法)。
5.软件开发的四个过程。
6.明确类和对象(对象的类命名通常是名词,类的行为通常是动词。)
7.静态变量和静态方法。(方法内的局部变量不能声明为static,静态变量能够由全部的类实例共享;静态方法能够经过类名称来调用,没必要实例化类的对象。)
8.类间关系(这章主要讲了依赖关系和聚合关系。)
9.常用在构造方法中的this语句。
10.包含常量和抽象方法的接口(Comparable接口和Iterator接口)。html
##教材学习中的问题和解决过程git
解答:变量的引用范围是该变量在程序中能够引用的区域。声明在类级的实例变量,能够被类中的任何方法引用。声明在一个特定方法中的局部变量(包括形式参数),都只能被该方法引用。程序员
解答:方法的返回值类型必须与方法声明首部中规定的返回值类型一致。当方法不返回任何值时,用void做为返回值类型。一条return语句由保留字return和后续的可选表达式组成。执行return语句时,控制当即返回到调用方法,并返回表达定义式的返回值。数据结构
解答:
静态变量有两种状况:
静态变量是基本数据类型,这种状况下在类的外部没必要建立该类的实例就能够直接使用
静态变量是一个引用。这种状况比较特殊,主要问题是因为静态变量是一个对象的引用,那么必须初始化这个对象以后才能将引用指向它。
所以若是要把一个引用定义成static的,就必须在定义的时候就对其对象进行初始化。
静态方法:与类变量不一样,方法(静态方法与实例方法)在内存中只有一份,不管该类有多少个实例,都共用一个方法。
静态方法与实例方法的不一样主要有:
静态方法能够直接使用,而实例方法必须在类实例化以后经过对象来调用。ide
问题1:使用IDEA输出中文为乱码。
函数
问题1解决方案:右下角选择GBK就能够正常输出中文。
学习
问题2解决方案:
原本思路为,利用格式化将double型转化为string,接着再次转化为double型。但事实证实,本题核心仍是在于实现接口,回顾书本,再结合网上。这样便可解决。this
(statistics.sh脚本的运行结果截图)设计
错题1:Inheritance through an extended (derived) class supports which of the following concepts?(继承经过扩展(派生)类来支持下列概念中的哪个?)
A.interfaces
B.modulary
C.information hiding
D.code reuse(代码复用)
E.correctness
错误解析:经过扩展一个类并继承它,新类不须要从新实现任何继承的方法或实例数据,从而节省了程序员的工做量。所以,代码重用是重用他人代码的能力,经过扩展它来知足您的需求。经过继承父类能够大大的缩减代码的重复,对于本身选择接口类的问题,表示本身当时很迷,不知道怎么回事就选择了接口。3d
错题2:Which of the following is true regarding Java classes?(对于Java类,下面哪一个选项是正确的?)
A.All classes must have 1 parent but may have any number of children (derived or extended) classes(全部的类都必须有一个父类,可是可能有任意数量的子类(派生的或扩展的)类。)
B.All classes must have 1 child (derived or extended) class but may have any number of parent classes
C.All classes must have 1 parent class and may have a single child (derived or extended) class
D.All classes can have any number (0 or more) of parent classes and any number of children (derived or extended) classes
E.All classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
错误解析:Java支持继承,但不支持多重继承,所以Java类能够有任意数量的子元素,但只有一个父类。此外,因为全部Java类都直接或间接地从对象类继承,全部Java类都只有一个父类。在作此题的时候,考虑了终极父类--Object类,由于它没有父类,因此选择则了E选项,可是,老师说能够把Object类看做本身是本身的父类的问题,我也表示很无奈。心疼这一分......
错题3:A variable declared to be of one class can later reference an extended class of that class. This variable is known as(声明为一个类的变量稍后能够引用该类的扩展类。这个变量被称为。)
A.protected
B.derivable
C.cloneable
D.polymorphic(多态)
E.none of the above, a variable declared to be of one class can never reference any other type of class, even an extended class
错误解析:术语多态意味着变量能够有多种形式。在通常状况下,Java被强烈定义为,一个变量,一旦被声明为一个类型,就永远不会改变为另外一种类型。例外的是,多态变量能够是任何类型的派生类(尽管不是同时,变量能够从一种类型转换为另外一种类型)。多态的问题,在看过第十章以后,明白了此题的答案,经过声明为父类的对象,就能够引用继承父类的子类的方法,这种灵活的操做就是经过继承实现的多态。
错误解析:多态变量能够包含许多不一样的类型,可是在程序执行以前,它不知道是哪种类型。在引用变量时,必须作出决策。这个决策是由运行时环境根据变量的最新分配而作出的。这道题也是有关多态的问题,因此看过第十章以后,是动态绑定的问题,效率较早期绑定低,可是动态绑定,体现了多态的灵活性。
错题5:Using the reserved word, super, one can(使用保留字super,能够)
A.access a parent class'constructor(s)
B.access a parent class'methods and instance data
C.access a child class'constructor(s)
D.access a child class'methods and instance data
E.none of the above
错误解析:保留字super提供了一种机制,用于访问父类的方法和实例数据(无论它们是否隐藏)。此外,可使用super来访问父类的构造函数。正确答案是A和B的组合选项。
错题6:If you instantiate an Abstract class, the class or object you wind up with(若是您实例化一个抽象类、类或对象会获得)
A.is also an Abstract class
B.is a normal class
C.is an Interface
D.is a reference to an Object
E.can't exist you cannot instantiate an Abstract class(不能存在不能实例化一个抽象类)
错误解析:您只能实例化具体的类而不是抽象类。可是您能够扩展抽象类和接口。
抽象类实际上是能够实例化的,可是他的实例化方式不是经过new方式来建立对象,而是经过父类的引用来指向子类的实例来间接地实现父类的实例化(由于子类要实例化前,必定会先实例化他的父类。这样建立了继承抽象类的子类的对象,也就把其父类(抽象类)给实例化了).可是:接口是不能被实例化的(接口压根就没有构造函数)。
错题7:A derived class has access to all of the methods of the parent class, but only the protected or public instance data of the parent class.(派生类能够访问父类的全部方法,但只访问父类的受保护或公共实例数据。)
A.true
B.false
错误解析:因为方法也能够声明为私有的,所以派生类没法访问任何私有方法。所以,派生类只能访问父类的受保护和公共方法和实例数据。没有看到访问全部方法,因此经过后半句就直接认为对了。
错题8:If class AParentClass has a protected instance data x, and AChildClass is a derived class of AParentClass, then AChildClass can access x but can not redefine x to be a different type.(若是类AParentClass有一个受保护的实例数据x,而AChildClass是一个派生类的AParentClass,那么AChildClass能够访问x,但不能从新定义x为另外一种类型。)
A.true
B.false
错题9
Aside from permitting inheritance, the visibility modifier protected is also used to
A. permit access to the protected item by any class defined in the same package
B. permit access to the protected item by any static class
C. permit access to the protected item by any parent class
D. ensure that the class cannot throw a NullPointerException
E. define abstract elements of an interface
正确答案: A 个人答案: B
解析:受保护的可见性修饰符用于以受保护的方式控制对项目的访问。保护是访问限于当前类(如私人项目),同一包中的类或此类的扩展类。
错题10
Which of the following is an example of multiple inheritance?
A. A computer can be a mainframe or a PC
B. A PC can be a desktop or a laptop
C. A laptop is both a PC and a portable device
D. A portable device is a lightweight device
E. Macintosh and IBM PC are both types of PCs
正确答案: C 个人答案: E
解析:多重继承意味着一个给定的类继承了多个父类。在上面列出的那些中,笔记本电脑继承了来自PC和便携式设备的特性。A,B和E中的答案都是单个继承的例子,其中一个班级至少有两个孩子(在A中,计算机有儿童大型机和PC,B,PC有儿童台式机和笔记本电脑,E,PC有孩子Macintosh和IBM PC)。答案D表示一个类的属性。
错题11
A variable declared to be of one class can later reference an extended class of that class. This variable is known as
A. protected
B. derivable
C. closeable
D. polymorphic
E. none of the above, a variable declared to be of one class can never reference any other type of class, even an extended class
正确答案: D 个人答案: A
解析:多态意味着变量能够有多种形式。在普通状况下,Java被强烈定义,即一旦声明为某个类型的变量永远不会变为不一样的类型。这是一个例外,多态变量能够是任何类型的派生类(尽管不是同时,变量能够从一种类型变为另外一种类型)。
错题12
Using the reserved word, super, one can
A. access a parent class ‘constructor(s)
B. access a parent class ‘methods and instance data
C. access a child class ‘constructor(s)
D. access a child class ‘methods and instance data
E. none of the above
正确答案: E 个人答案: B
解析:super保留字提供了访问父类的方法和实例数据(无论它们是否隐藏)的机制。另外,可使用super访问父类的构造器。因此正确的答案是A和B的组合,这不是一个选项,因此正确答案是E.
错题13
Why shouldn't an abstract method be declared final?
A. There's nothing wrong with doing so
B. Abstract methods cannot be overridden and they must be if a concrete class ever is to be instantiated
C. So long as the Abstract method never actually is used in by any other method, there's no problem with doing this
D. As long as the Abstract method is declared in a Class (not an Interface), there's nothing wrong with doing this
E. None of the above
正确答案: B 个人答案: E
解析:为了使抽象方法变得具体,它必须被覆盖。声明一个方法是最终的,所以不可能覆盖它。这是一个矛盾,是被禁止的。
错题14
If class AParentClass has a protected instance data x, and AChildClass is a derived class of AParentClass, then AChildClass can access x but cannot redefine x to be a different type.
A. true
B. false
正确答案: B 个人答案: A
解析:派生类能够从新定义父类的任何实例数据或方法。父类的版本如今隐藏了,可是能够经过使用super来访问,就像在super.x中同样。
错题15
Although classes can be inherited from one-another, even abstract classes, interfaces cannot be inherited.
A. true
B. false
正确答案: B 个人答案: A
解析:接口具备普通类所具备的全部继承属性。所以,您能够建立一个Interface继承层次结构,就像您能够建立一个Class继承层次结构同样。然而,你不能作的是实例化他们必须实现的接口。
教材学习中的问题和解决过程, 一个问题加1分
代码调试中的问题和解决过程, 一个问题加1分
基于评分标准,我给本博客打分:11分。得分状况以下:正确使用Markdown语法+1.教材学习中的问题和解决过程+2.代码调试中的问题和解决过程+2.感想,体会不假大空+1.错题学习深刻+1.点评认真,能指出博客和代码中的问题+1.结对学习状况真实可信+1.课后题有验证+1,进度条有记录+1.
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 200/200 | 2/2 | 20/20 | |
第二周 | 350/500 | 2/4 | 24/38 | |
第三周 | 512/1000 | 3/7 | 22/60 | |
第四周 | 1158/1300 | 4/9 | 35/90 |