Home > Java > javaTutorial > body text

Memo for beginners to learn Java (4)

黄舟
Release: 2016-12-20 13:48:42
Original
1584 people have browsed it


Having said so much, I haven’t written down several basic functions of threads. Now let’s supplement

start a thread
T1=new YourThread();
T1.start()

operate threads
T1.run() , As mentioned before, starting the thread will automatically perform this operation

Suspend
T1.suspend()//It is different from Sleep(), it means suspending a thread without setting a time
Corresponding to suspension, we also You can reactivate a thread
T1.resume()

Stop the thread
T1.stop()//But it does not destroy the thread

Test whether the thread is activated
T1.isAlive()//This is a function, returned It is a Boolean value

Enter network programming: Sockets
See how much I can understand from memory: Sockets are in the session layer of the seven-layer protocol. Its job is to tell the application that it is going to send information to the network and hide the sending details. Open For example, when we make a phone call, we only need to dial the number, pick up the receiver, and speak. We don’t need to care about how our voice is transmitted to the other party through the phone line. Sockets are the phone, and all the secrets are It's all in this phone.

I took a preliminary look at the concept of Sockets, and it seems that there are some things in the programs involved that I haven’t touched yet, so I’ll put them aside first.

The above is the content of the memo (4) for beginners learning Java. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template