C # BASICS (2)

Source: Internet
Author: User

1. If I try a finally object and try has a return object, will the finally object code run? If it is run, whether it is after return or before return: it will run and run after return.

 

2. After a thread enters a synchronized method of an object, can other threads access other methods of this object?

A: No. One Synchronized Method of an object can only be accessed by one thread.

 

3. What is the difference between a process and a thread?

A: A process is the unit of resource allocation and scheduling by the system. A thread is the unit of CPU scheduling and scheduling. A process can have multiple threads which share the resources of the process.

4. What is the difference between stack and stack?

A: Stack: the stack is automatically allocated and released by the compiler. Variables defined in the function body are usually on the stack.

Heap: usually assigned and released by programmers. The memory allocated by using new and malloc functions is on the heap.

 

5. Do I use run () or start () to start a thread ()?

When a thread is started, the START () method is called to make the virtual processor represented by the thread in a running state, which means that it can be scheduled and executed by JVM. This does not mean that the thread will run immediately. The run () method can generate the exit sign to stop a thread.

 

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.