Java Note 3

Source: Internet
Author: User

/*
Java Data types

Java is a strong data type language and has a specific data type for each data type.




Data type 4 Classes 8 kinds
Basic data types
Integral type
Byte 1 bytes
Short 2
int 4
Long 8 L l
Floating point
Float4 F F
Double 8
Boolean
True
False

Integer default int
Decimal default Double
Reference data type class interface array



Considerations for using Variables
1. Scope
2, the same scope cannot have two variables with the same name

3. Initialization value
Must be assigned before use. It is recommended to give values at the time of definition.

To define the format of a variable:
1. Variable name of data type = initialization value
2, the data type variable name;
Variable name = initialization value;


Conversion of data types
In general, we require that the data types of the operations be consistent.
For example
int x=3;
int y=4;
int z=x+y;

Define a byte type, an int type to do the addition.
BYTE A=3;
int b=3;


Default data type conversions
Byte,short,char,int,long,float,double
Byte,short,char are not converted to each other, and their participation in the operation is first converted to the int type.



Indicates that a Boolean type cannot be converted to a data type
*/

Java Note 3

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.