Java basic data types and encapsulation classes

Source: Internet
Author: User

1 Boolean vs Boolean

Public final classBoolean
Extends object
Implements serializable, comparable <Boolean>
 
 

The basic type of the Boolean class isBooleanThe value is packaged in an object. OneBooleanType objects only contain one typeBoolean.

In additionBooleanAndStringProvides many methods for mutual conversion and provides ProcessingBooleanOther constants and methods that are very useful.

2 byte vs byte

Public final classByte
Extends number
Implements comparable <byte>
 
 

ByteClass will be the basic typeByteThe value is packaged in an object. OneByteType objects only contain one typeByte.

In addition, this class isByteAndStringProvides several methods for mutual conversion and processing.ByteOther constants and methods that are very useful.

 

3 character vs char

Public final classCharacter
Extends object
Implements serializable, comparable <character>
 
 

CharacterClass encapsulates a basic type in the objectChar.CharacterThe type object containsChar.

In addition, this class provides several methods to determine the character category (lowercase letters, numbers, and so on), convert the characters from uppercase to lowercase, and vice versa.

4 double vs double

Public final classDouble
Extends number
Implements comparable <double>
 
 

DoubleClass encapsulates a basic type in the objectDouble. EachDoubleAll types of objects containDoubleType field.

This class also provides multiple methodsDoubleConvertString, SetStringConvertDoubleAnd provides other processing functions.DoubleUseful constants and methods.

5 float vs float

Public final classFloat
Extends number
Implements comparable <float>
 
 

FloatClass encapsulatesFloatValue of the basic type.FloatType object containsFloatType field.

In addition, this class provides several methodsFloatType andStringType conversion and ProcessingFloatType.

6 integer vs int

Public final classInteger
Extends number
Implements comparable <integer>
 
 

IntegerClass encapsulates a basic type in the objectInt.IntegerType object containsIntType field.

In addition, this class provides multiple methodsIntType andStringData types are converted to each other, and processing is also provided.IntType.

7 long vs long

Public final classLong
Extends number
Implements comparable <long>
 
 

LongClasses encapsulate basic types in objectsLong. EachLongAll types of objects containLongType field.

In addition, this class provides multiple methodsLongConvertString, SetStringConvertLongIn addition, some other processing functions are provided.LongUseful constants and methods.

8. Short vs short

Public final classShort
Extends number
Implements comparable <short>
 
 

ShortClass to wrap basic types in objectsShort. OneShortType object only contains oneShortType field.

In addition, this class provides multiple methodsShortConvertString, SetStringConvertShortAnd provides other processing functions.ShortUseful constants and methods.

9

Public final classVoid
Extends object
 
 

The void class is a placeholder class that cannot be instantiated. It maintains a reference to the class object that represents the Java keyword void.

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.