Java study notes-basic data types

1. Java data types

【基本数据类型】逻辑类型、整数类型、字符类型、浮点类型。
【数据引用类型】数组、类、接口。

Java basic data types

Second, identifiers and keywords

【标识符】第一个字符为字母、美元符号($)、下划线(_)中的一个,后续为字母、数字、美元符号($)、下划线(_)。
【关键字】

Three, variables and constants

【变量】单精度型常量后面必须要有后缀“f”“F”
【常量】必须用final修饰。

Fourth, the conversion between simple data types

(1)基本数据类型之间的相互转换。
(2)引用数据类型之间的相互转换。
(3)字符串与其它数据类型之间相互转换。

5. Basic input and output

【输入】Scanner类的适用
	Scanner reader = new Scanner(System.in);
	int length =  reader.nextInt();
	// 常用的方法有:nextInt()、nextBoolean()、nextByte()、nextshort()、nextLong()、nextFloat()、nextDouble().
【输出】System.out.print()
	输出基本数据类型的数据、字符串、表达式。
Published 27 original articles · Like1 · Visits 996

Guess you like

Origin blog.csdn.net/qq_41320782/article/details/105589359