20165111 2016-2017-2 "Java program design" the second week to summarize the learning content of learning materials
The content of this chapter will be compared with the C language study
Basic data types
- The Java language uses the Unicode standard character set, which includes not only ASCII code, but also all the text in history. Therefore,the variable names in Java can use Chinese characters.
- The keyword for a logical type is Boolean, and the constant is true,false instead of 0,1.
- There is no unsigned number for the Java integer type, and there is no unsigned similar to C language.
- The declaration of a single-precision floating-point (float) variable must have a suffix f/fafter the constant amount.
input and output data
Input
Scanner reader = new Scanner(System.in);类型名 变量名 = reader.next变量名(首位大写)
Output
System.out.print()或 不换行输出System.out.println() 换行输出
Allows you to use the collocated symbol + to output a variable, an expression, or a constant value with a string.
Array
Statement
int []a,b或int a[],b[];
Note: Java does not allow brackets in the declaration array to specify the number of array elements, that is, do not allow
int a[10]或int [10]a;
Distribution
数组名 = new 数组元素的类型[数组元素的个数]
Note: Java allows you to specify the number of elements of an array using the INT variable, which allows
int size=10;double number[]=new double[size];
Problems in teaching materials learning and the solving process
In a few examples of textbooks, the main program begins
import java.util.*
You can refer to this blog for the relationship between import and package.
Problems in code debugging and the resolution process
For the above mentioned in the code containing the import package, compile and run the same as before with the package is now playing with special treatment, normal operation can be.
Code Hosting
20165111 2017-2018-2 "Java programming" the second week study summary