20165217 2017-2018-2 "Java Programming" 8th Week study Summary

Source: Internet
Author: User
Tags thread class

20165217 2017-2018-2 "Java Program Design" 8th Week study summary Textbook study summary
    • Process-to-thread relationships
    • Multi-threaded operation mechanism
    • Four states of a thread: new, running, Interrupted, dead
    • Use the thread class or subclass to create the characteristics of a threading object
    • Common Methods for threading:
      The start () thread calls the method to start the thread;

Run () defines the operations that are performed after the thread object is dispatched;

Sleep (int millsecond) causes high-priority threads to discard CPU resources and hibernate for a period of time. The sleep method must be called in the Try-catch statement block;

When the isAlive () thread is in the new state, the thread calls the IsAlive () method to return false. The thread calls the IsAlive () method to return True before the run () method of the threads ends, that is, before the death state is entered. When the thread enters the dead state, the thread calls the method IsAlive (), at which time the return value is false.

    • Daemon Thread: The thread defaults to a non-daemon thread, and the thread must set itself as a daemon before running. You can call Voidsetdaemon (Boolean on) to set yourself as a daemon thread. When all non-daemon threads run at the end, the daemon thread must end.

      Problems in teaching materials learning and the solving process
    • Question 1: What is a time slice?
      Problem 1 Solution: Through Baidu query, the time slice that the CPU allocates to each program time, each thread is allocated a time period, is called its time slice, namely this process allows the time to run, makes each program on the surface is simultaneously carries on.

Code Hosting

Last week's summary of the wrong quiz
    • Error 1: The following data manipulation languages are: A.insert and b.update
      Cause: Unclear understanding of the data manipulation language. Select is also selected as the data manipulation language.

Understand the situation: have mastered the basic content of the data manipulation language.

    • Wrong question 2 and understanding: Statement's Executeupdate () method returns whether the successful int value is updated.

20165217 2017-2018-2 "Java Programming" 8th Week 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.