201671010140.2016-2017-2 Java Program Eighth week of Java learning

Source: Internet
Author: User
Tags shallow copy

Eighth Week Java Learning

This week, the teacher led us to improve the inheritance, excuses, copies, lambda expressions, internal categories lack, imperfect place, help us to check the gaps.

as an example of copy learning, I had a very superficial understanding of the copy, the deep copy and the shallow copy is: Deep copy is to create a new object, contrast shallow copy, change the copy of the object properties will not affect the original object. After more careful study, it is understood that there are three ways to copy a reference to an object to another object. The first method is direct assignment , the second is a shallow copy , the third is a deep copy, and their essence is copy, copy. a basic data type, there are two ways to copy it: (1) Create a new object and copy the non-static field of the current object to the new object, copy the field if the field is a value type, or copy the reference without copying the referenced object if the field is a reference type. Therefore, the original object and its copy refer to the same object. (2) creates a new object and then copies the non-static fields of the current object to the new object, whether the field is a value type or a reference type. These two copies are called Light and deep copies, respectively. in my opinion, the dead point of a shallow copy is that the original object and its copy refer to the same object, while a deep copy keeps them from pointing to the same object.

Overall, this week's study is very rewarding, but in the experiment still encountered a lot of difficulties, interface settings, sub-class function allocation, the function of the main function coordination, I hope the teacher will lead us to design, complete a program, exercise our program design capabilities.

201671010140.2016-2017-2 Java Program Eighth week of Java learning

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.