Home > Java > Javagetting Started > body text

What data types does java have?

(*-*)浩
Release: 2019-11-09 13:52:37
Original
9369 people have browsed it

Java's basic data types, also called built-in types, are data types provided by the Java language itself and are the basis for referencing other types.

What data types does java have?

The basic data types of Java are divided into four types: integer type, floating point type, character type, and Boolean type.

Integer type                                                                                          

##Integer type variables are used to represent the data type of integers. Integer types are divided into four types: byte, short, int, and long.

Floating point type

The floating point type is the data type used to represent decimals. Floating point types are divided into two types: float (single precision type) and double (double precision type). float (single precision type) is generally used when precision requirements are not high. Double (double precision type) is generally used when the numerical precision is high.

Character type

The keyword of character type is "char".

Boolean type

The Boolean type is the basic data type that represents logical values. Boolean constants have two states: "true" and "false". Generally, true is used to represent "true" and false is used to represent "false". It is defined by adding the type keyword boolean before the variable name.

What data types does java have?

The methods they define are to add the type keyword in front of the variable name. You must keep these data types in mind so that you can be proficient in future writing. use. There will be data type conversion in the later stage, which is very important and serves as a foundation for later stage.

The above is the detailed content of What data types does java have?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template