JAVA Character Class

Source: Internet
Author: User

The Character class is used to manipulate individual characters.

The Character class wraps the value of a base type char in an object

char ch = ' A '//  Unicode character representation char unichar = ' \u039a ';   // character Array Char [] Chararray ={' A ', ' B ', ' C ', ' d ', ' e '};

However, in the actual development process, we often encounter situations where objects need to be used rather than built-in data types. To solve this problem, the Java language provides the wrapper class character class for the built-in data type char.

The character class provides a series of methods to manipulate characters. You can create a character class object using character's construction method, for example:

New Character (' a ');

In some cases, the Java compiler automatically creates a character object.

For example, when a parameter of type char is passed to a method that requires a character type parameter, the compiler automatically converts the char type parameter to the character object. This feature is called boxing , which in turn is called unpacking .

// the original character ' a ' is boxed into the Character object ch Character ch = ' A '//  raw character ' X ' is boxed with the test method / / Returns the value of the unboxing to ' C 'char c = Test (' x ');
Escape Sequences

Character Method

JAVA Character Class

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.