Basic Java Knowledge

Source: Internet
Author: User

---restore content starts---

I. Reserve Knowledge:

1. Memory structure analysis;

The 2.main method is a thread;

3.run () is the normal way to create threads, at which point the thread has not yet entered the ready state;

The role of the 4.start () method is to turn the process into a ready state;

5. There are two ways of creating a thread:

(1) Direct implementation of the Runnable interface, the interface only a run () method, run () write the method you want to execute;

(2) Inherit the thread class, rewrite the Run method, where the thread class has implemented the Runnablel interface;

In the actual programming is still proposed to implement the interface, because the class is a single inheritance, interface is multi-inheritance;

---restore content ends---

When you look at the code, consider the location of the variable in memory:

1. Memory Analysis:

Basic Java Knowledge

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.