Home >类库下载 >java类库 >java built-in data types

java built-in data types

高洛峰
高洛峰Original
2016-11-03 17:34:221937browse

Constant is a quantity that will not be modified while the program is running.

 Using the final keyword in Java to modify constant declarations is similar to variables

 finaldouble PI =3.1415927;

 Although constant names can also be in lowercase, capital letters are usually used to represent constants for ease of identification.

 Literals can be assigned to variables of any built-in type. For example

 byte a =68; char a ='A'

 Byte, int, long, and short can all be represented in decimal, hexadecimal and octal.

When using constants, the prefix 0 represents octal and the prefix 0x represents hexadecimal. For example

 intdecimal=100; int octal =0144; int hexa =0x64;

 Like other languages, Java's string constants are also character sequences contained between two quotation marks. The following is an example of a string literal

  "Hello World" "twonlines" ""This is in quotes""

  Both string constants and character constants can contain any Unicode characters. For example

 char a ='u0001'; String a ="u0001";

 Java language supports some special escape character sequences.

java built-in data types

Statement:
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