Java basic data types, describing its classification, write a simple program, each declare a variable initialization and its output value
/*
*Java基本数据类型
* 基本数据类型:数值,字符,布尔型
*引用数据类型:类,接口,数组,枚举,注解
*/
class Chapter2HomeWork {
public static void main(String[] args) {
byte byte_num = 127;
short short_num = 32767;
int int_num = 123456;
long long_num = 12345678L;// long类型后面加L
float float_num = 123.456F;// float类型后面加F
double double_num = 123.456;
char charcter = 'a';
boolean boolean_variable = true;// Boolean类型只有true和false两种取值
System.out.println(byte_num);
System.out.println(short_num);
System.out.println(int_num);
System.out.println(long_num);
System.out.println(float_num);
System.out.println(double_num);
System.out.println(charcter);
System.out.println(boolean_variable);
}
}
What are the characteristics of the array is Java? How to create and use an array of objects? A set of integers is stored in an array, and outputs a maximum and minimum therein; and then the array elements in ascending order output
Example2 a design class, calculated from 1 + 2 + 3 + ~~~ 100