Thinking in Java (I)-Object

Source: Internet
Author: User

I chose the second edition when reading this book because the translator is Hou Jie ..

First, there are five basic guidelines for introduction to object.

Then let's talk about the generation and destruction of objects. In many cases, C ++ compares them.

Although many people on the Internet say this book is not suitable for beginners, I think it can be used directly.

In particular, many of the C ++ camp's students are also transitioning from C ++. the basics are good.

Of course, there are some mysteries that you won't be able to read twice or twice... Write wellCodeRight

Below I will write some texts in my notebook, which are basically some of the most important topics in the previous chapters.

Stack memory:

C ++ generates the default object in the stack area. If the object knows the quantity, lifetime, type, and other information during the execution period, you must apply for and release the object using manual memory.

This practice sacrifices efficiency in exchange for elasticity (but there is a serious risk of Memory leakage)

In Java, objects (except basic types) must be generated in the stack and have a powerful Garbage Collector mechanism.

Binding of member functions:

C ++ is non-dynamic by default.

By default, Java is dynamic. In C ++, all member functions are virtual functions.

Single inheritance system:

All classes in Java inherit from a single basic class: Object

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.