The difference between single and double quotes and string and char in Java

Source: Internet
Author: User
The difference between single and double quotes and string and char in Java The data for single quotation marks is of type char.
The data for double quotation marks is of type string
Single quotes can only quote one character
and double quotes can lead to 0 and above

***************

Char is defined with single quotes, only one letter, number. Char c= ' C ';
string with double quotation marks, can be one, may be more than one letter, kanji and so on. is called a string. String s= "Adsaf";
Char is just a basic type, and string is a class that can be referenced directly.
such as Char c= ' C '; The method cannot be called directly on C.
String s= "ABC"; You can call S.charat (0), and so on, because string is the class, and that is the object's call.

The difference between single and double quotes and string and char in Java

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.