Java. lang. Void class learning notes in java

Source: Internet
Author: User

When reading the JDK source code, we found a Class named Void, which is a non-instantiated placeholder Class that holds a reference to the Class object that identifies the Java keyword Void.

The Void class is defined as follows:

Package java. lang;
Public final class Void {
Private Void (){
  }
Public static final Class TYPE = Class. getPrimitiveClass ("void ");
}

I found the source code of the ThreadGroup class. The source code is as follows:

Public ThreadGroup (ThreadGroup threadgroup, String s ){
This (checkParentAccess (threadgroup), threadgroup, s); // The checkParentAccess () method does not return a value. this will call the following construction with parameters.
}

Private ThreadGroup (Void void1, ThreadGroup threadgroup, String s ){
NUnstartedThreads = 0;
Name = s;
MaxPriority = threadgroup. maxPriority;
Daemon = threadgroup. daemon;
VmAllowSuspension = threadgroup. vmAllowSuspension;
Parent = threadgroup;
Threadgroup. add (this );
}

In addition to the above usage, I still don't know what other special usage of the Void class is. Write down it first.

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.