What are some of the basic data types in Java that can represent numbers?

Source: Internet
Author: User

Java has a total of 8 basic types, byte byte, 8 bits, short shorter integer, 16 bit, int integer, 32 bit, long integer, 64 bit, float single precision floating point, 32 bit, double dual precision floating point, 64 bit, char character type, 16 bit And a Boolean Boolean type. So, what are the basic types that can represent numbers? It's obvious that byte,short,int,long,float,double is all right, and the question is whether Char and Boolean are allowed. So I'm going to tell you that char type can, because all the characters behind it all correspond to this string of numbers, you define a character is actually quite with the definition of a string of numbers, so the char type can represent a number, but char cannot represent negative numbers, its value range is (0~65535) (0~2^ 16-1). The only basic data type that cannot represent numbers is the Boolean type. In c it is possible to perform operations such as while (1), whereas in Java it can only be while (true), which is the difference between C and Java.

What are some of the basic data types in Java that can represent numbers?

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.