流程控制 分支 循环语句
     if...else...
     if...else if...else
     switch(值0) {          ------------值0是什么类型, case后面的值就要是什么类型
       case 值1:
         执行语句
         break;
       case 值1:
         执行语句
         break;
       default:
         执行语句
         break;
       }
     while(条件) {
     }
     do{执行语句}while(判断条件)
int a = 100;
do{
System.out.println("OK! b==100");
b--;
}
while(b==60);
     for(初始值;条件判断;初始值改变) {
   }
     for(int a : 数组(int)){
     }
数据类型转换:
     隐式转换(我们看不到转换的过程)
     条件:
     由低精度向高精度转换
       double 16位      1.22222222222
       float 8位           1.2222222
       double>float>long>int>short>byte
     显式转换
       long a = 15;
       int l = (int)a;
字符串的操作
     基础数据类型
       int a = 5;
Integer i = new Integer(5);
     栈---str1
     堆---地址("山里有座庙")
       String str = "从前有座山"; //引用类型
       String str2 = "abc";
       String str3 = "abc";
     常量池的概念
       str2==str3;---true(比较的是两个地址)
       String str1 = new String("山里有座庙");-------开辟一个新的存储空间
       String str0 = new String("山里有座庙");
       str1==str0;---false
数组:定义方式 int[] a; int a[];
  public class TestArray
  {
     public static void main(String[] args) {
       int[] a = new int[5];-----------定义长度为5的整形数组
//String str = "qwertyu";
char[] c = {'a','b','c','a','s','d','g'};
String str = new String(c);
System.out.println(str);-----------输出数组c中的值
System.out.println(str.length());------长度为7
System.out.println(str.indexOf("a"));------输出第一个a的位置0
System.out.println(str.lastIndexOf("a"));-----最后一个a的位置3
char c1 = str.charAt(2);
System.out.println(c1);---------输出2位置的值C
String s1 = str.substring(5)
String s2 = str.substring(2,4);//不包括4
System.out.println(s1);;------输出dg
System.out.println(s2);------输出ca
String str11 = " its a new world, its a new start ";
System.out.println(str11.trim());-------只去掉前面和后面的空格, 中间的不
System.out.println(str11.trim().replace("i","_"));
System.out.println(str11.trim().replace('t','+'));
//replaceAll是使用正则表达式的替换
System.out.println(str11.trim().replaceAll("\\s","6"));
String ss1 = "abc";
String ss2 = "def";
System.out.println(ss1.equals(ss2));------比较两个字符串的值是否相等
String sss = "1,2,3";
String[] sarr = sss.split(",");------分割
for(String s : sarr) {
//System.out.println("sarr: "+s);
}
System.out.println(str11.toUpperCase());----转换大写
System.out.println(str11.toLowerCase());-----转换小写
String temp = "";
//String[] newstr11 = str11.split("");
for(int i = 0; i < str11.length(); i++) {
if(str11.charAt(i).equals(' ')) {
//temp += newstr11[i];
newstr11[i] = "";
}
}
System.out.println(temp);
     }
  }
int[] a = new int[4];
  //填充数组
   Arrays.fill(a, 7);
   //填充一部分数组
   Arrays.fill(a, 0, 2, 8);
   //复制数组
   int[] newa = Arrays.copyOf(a, 3);
   //复制一部分数组
   int[] newa1 = Arrays.copyOfRange(a, 0, 2);
   //数组排序
   int[] aa = new int[]{24,54,33,55,43,53};
   Arrays.sort(aa);
   //数组的查询, 使用的是二分搜索法
   int m = Arrays.binarySearch(aa, 54);
   int n = Arrays.binarySearch(aa, 0, 3, 54);
   System.out.println(n);