java data types acquaintance

type of data

Data type classification

Java data types are divided into two categories:

  • Basic data types include: integers, floating point, character, Boolean.
  • Reference data types : a class, arrays, interfaces.

Basic data types

Four eight basic data types: as shown below

Precautions:

  • String is not a basic type, but reference types.
  • Float may only be an approximation, not an exact value.
  • The number of bytes of data does not necessarily correlate with the range of, for example, a wider range than the data float long, but float is 4 bytes, long 8 bytes.
  • Among the default floating-point type is double. If you must use a float, you need to add a suffix F. If is an integer, the default type int, if we must use the long type, you need to add a suffix L. We recommend the use of capital letters suffix.

Guess you like

Origin www.cnblogs.com/wurengen/p/11861752.html