Differences between Java character constants and string constants

Source: Internet
Author: User

Form: Character constant is an example of a single quote: ' A '
String constants are a number of characters "HelloWorld" caused by double quotation marks
Meaning: A character constant is the equivalent of an integer value (asc| | Value), you can join the expression operation, directly take the variable to use
A string constant represents an address value (where the character is stored in memory)
Memory Size:
Character constants account for only one byte
A string constant takes up several bytes
Character constants are stored using the Char type variable.
The string is stored in an array of type char.

Type character type is char, String type
Both are constants, and differ from the way they are used

Differences between Java character constants and string constants

Related Article

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.