20145105 Java Programming 3rd week of study summary

Source: Internet
Author: User

20145105 "Java Program Design" 3rd week study summary textbook Study content summary fourth Chapter understanding Object

First, class and object

要产生对象必须先定义类,类是对象的设计图,对象是类的实例。

(i) Defining classes

1.类定义时使用class关键词2.建立实例时使用new关键词3.在类中定义的变量,叫做值域成员或对象数据成员ps:一个原始码中可以有多个定义类,但只能有一个是公开类,且文档中的主文档名必须与公开类相同

(ii) Use of standard classes

1.使用java.util.Scanner(创建实例)2.使用java.math.BigDecimal(得到更好的精确度)

(iii) object designation and equality

1."=",用于指定参考名称参考某个对象2."==",用于比较两个参考名称是否参考同一对象

Ii. Basic Type Packager

(i) Packaging basic type

让基本类型像对象一样操作,可以使用Long、Integer、Double、Float、Boolean、Byte等类来打包

(b) automatic packing and unpacking

1.使用Integer wrapper = 10打包基本类型2.使用Number类来自动装箱3.自动拆箱:即自动取出打包器中的基本形态信息

Three, Array object

(i) Array basics

1.数组基本上是用来收集数据,是具有索引的数据结构2.数组是对象,而不是单纯的数据集合3.一维数组使用一个索引存取数组元素,二维数组使用两个索引存取数组元素

(ii) Manipulating array objects

1.使用java.util.Arrays的fill()方法来设建数组的元素值2.int[]之类声明的变量就是参考变量

(c) Array replication

1.自行使用循环做值的复制2.使用System.arraycopy()方法,使用原生方式复制每一个索引元素3.使用Arrays.copyOf()

Four, String Object

(i) String basis

1.字符串本质是打包字符数组的对象,是java.lang.String类的实例

(b) String characteristics

1.用""写下的字符串称为字符串常量2.在java中,字符串对象一旦建立,就无法更改对象中任何内容,对象上没有任何方法可以更改字符串内容。可以使用 + 连接字符串,改用StringBuilder来改善
Chapter Fifth Object Encapsulation

First, what is encapsulation

封装(Encapsulation)实际上是使用方法(Method)将类的数据隐藏起来,控制用户对类的修改和访问数据的程度,隐藏对象细节,将对象当作黑箱进行操作1.通过构造方法(构造函数)封装初始化流程2.通过成员方法(函数)封装操作3.通过成员变量封装数据ps:(1)private关键字:是一个权限修饰符。用于修饰成员(成员变量和成员函数)。被私有化的成员只在本类中有效    (2)功能:将成员变量私有化,对外提供对应的set ,get 方法对其进行访问。可提高对数据访问的安全性

Second, class syntax details

(i) Public permission decoration

如果没有声明权限修饰的成员,只有在相同包的类程序代码下才可以直接存取,也就是“包范围权限”。如果想在其他包的类程序代码中存取某包的类或对象成员,则该类或对象成员必须是公开成员,在java中要使用public加以声明。

(ii) About constructors

1.函数名与类名相同 2.不用定义返回值类型3.不可以写return语句4.多个构造函数是以重载的形式存在的

(iii) Constructors and method overloading

重载构造函数:视使用情景或条件不同,创建对象时也许希望有对应的初始流程。可以定义多个构造函数,只要参数类型或个数不同。

(d) Use this

1.this代表其所在函数所属对象的引用,换言之:this代表类对象的引用2.当在函数内需要用到调用该函数的对象时就用this

(v) Static class members

1.用于修饰成员(成员变量和成员函数)2.被修饰后的成员具备以下特点:  (1)随着类的加载而加载  (2)优先于对象存在  (3)被所有对象所共享  (4)可以直接被类名调用3.使用注意:  (1)静态方法只能访问静态成员  (2)静态方法中不可以写this,super关键字  (3)主函数是静态的
Problems in teaching materials learning and the solving process

Four, 52 chapters have a lot of the term, accept it more difficult, there are many places to see a few times can not understand, through comparative learning materials and video, just understand some obscure content.

Problems in code debugging and the resolution process

To the students to learn the use of idea, learned to create a new class in the SRC folder, in order to run the code, because it is a copy of the code, so in writing and running the process did not appear any problems.

Other (sentiment, thinking, etc., optional)

Although not with idea, Baidu can not find a targeted novice tutorial, but has been dragged without asking classmates, this time learned how to use the code in the process of writing and running to reduce a lot of unnecessary trouble, save a lot of time. In the future, I find that the problem should be solved in time, reduce the time wasted in the operation of procrastination and improve the learning efficiency.

Learning progress Bar

| | Lines of code (new/cumulative) | Blog volume (Add/accumulate) | Learning time (NEW/cumulative) | Important growth |

| -------- | :----------------:|:----------------:|:---------------: |:-----:|

| Target | 5000 Rows | 30 Articles | 400 hours | |

| First week | 70/70 | 1/1 | 14/14 | |

| Second week | 150/220 | 1/2 | 18/32 | |

| Third week | 400/620 | 1/3 | 35/67 | |

Resources
      • Java Learning Notes (8th Edition)
      • Java Learning Note (8th Edition) Learning Guide

20145105 Java Programming 3rd week of study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.