guyanqing 6 ماه پیش
والد
کامیت
9ac33e5497
100فایلهای تغییر یافته به همراه1063 افزوده شده و 2409 حذف شده
  1. 0 1
      src/main/java/com/sf/day03/T.java
  2. 23 10
      src/main/java/com/sf/day06/Cat.java
  3. 77 0
      src/main/java/com/sf/day06/Mouse.java
  4. 70 0
      src/main/java/com/sf/day06/Person.java
  5. 13 0
      src/main/java/com/sf/day06/PersonTest.java
  6. 85 0
      src/main/java/com/sf/day06/Student.java
  7. 11 0
      src/main/java/com/sf/day06/Te.java
  8. 22 15
      src/main/java/com/sf/day06/entend/Animal.java
  9. 33 0
      src/main/java/com/sf/day06/entend/Cat.java
  10. 110 0
      src/main/java/com/sf/day06/entend/CreditCard.java
  11. 72 0
      src/main/java/com/sf/day06/entend/DepositCard.java
  12. 30 0
      src/main/java/com/sf/day06/entend/Mouse.java
  13. 0 64
      src/main/java/com/sf/quanrizhi/T.java
  14. 0 14
      src/main/java/com/sf/quanrizhi/day01/Column.java
  15. 0 15
      src/main/java/com/sf/quanrizhi/day01/Data.java
  16. 0 5
      src/main/java/com/sf/quanrizhi/day01/MyPredicate.java
  17. 0 60
      src/main/java/com/sf/quanrizhi/day01/Product.java
  18. 0 46
      src/main/java/com/sf/quanrizhi/day01/Student.java
  19. 0 44
      src/main/java/com/sf/quanrizhi/day01/Student1.java
  20. 0 385
      src/main/java/com/sf/quanrizhi/day01/T.java
  21. 0 14
      src/main/java/com/sf/quanrizhi/day01/Table.java
  22. 0 34
      src/main/java/com/sf/quanrizhi/day01/User.java
  23. 0 207
      src/main/java/com/sf/quanrizhi/day02/Te.java
  24. 0 62
      src/main/java/com/sf/quanrizhi/day02/User.java
  25. 0 135
      src/main/java/com/sf/quanrizhi/day03/TE.java
  26. 0 192
      src/main/java/com/sf/sx/day01/Te.java
  27. 0 81
      src/main/java/com/sf/sx/day02/TE.java
  28. 0 55
      src/main/java/com/sf/sx/day03/Te.java
  29. 0 28
      src/main/java/com/sf/sx/day04/BSX.java
  30. 0 122
      src/main/java/com/sf/sx/day04/Car.java
  31. 0 27
      src/main/java/com/sf/sx/day04/DP.java
  32. 0 41
      src/main/java/com/sf/sx/day04/FDJ.java
  33. 0 65
      src/main/java/com/sf/sx/day04/Person.java
  34. 0 12
      src/main/java/com/sf/sx/day04/PersonUtils.java
  35. 0 79
      src/main/java/com/sf/sx/day04/Student.java
  36. 0 84
      src/main/java/com/sf/sx/day04/TE.java
  37. 0 50
      src/main/java/com/sf/sx/day04/l2/Mouse.java
  38. 0 71
      src/main/java/com/sf/sx/day04/l2/Phone.java
  39. 0 22
      src/main/java/com/sf/sx/day04/l2/extend/Cat.java
  40. 0 22
      src/main/java/com/sf/sx/day04/l2/extend/Mouse.java
  41. 0 16
      src/main/java/com/sf/sx/day05/Te.java
  42. 0 8
      src/main/java/com/sf/sx/day05/lx/Animal.java
  43. 0 13
      src/main/java/com/sf/sx/day05/lx/Car.java
  44. 0 14
      src/main/java/com/sf/sx/day05/lx/NewCar.java
  45. 0 15
      src/main/java/com/sf/sx/day05/lx/OldCar.java
  46. 0 10
      src/main/java/com/sf/sx/day05/lx/impl/AnimalImpl.java
  47. 0 57
      src/main/java/com/sf/sx/day06/TE.java
  48. 0 60
      src/main/java/com/sf/sx/day07/Data.java
  49. 0 5
      src/main/java/com/sf/sx/day07/MyPredicate.java
  50. 0 60
      src/main/java/com/sf/sx/day07/Product.java
  51. 0 83
      src/main/java/com/sf/sx/day07/Te.java
  52. 20 6
      src/main/java/com/sf/sx2/Person.java
  53. 65 0
      src/main/java/com/sf/sx2/Person1.java
  54. 11 0
      src/main/java/com/sf/sx2/PersonUtils.java
  55. 50 0
      src/main/java/com/sf/sx2/Phone.java
  56. 97 0
      src/main/java/com/sf/sx2/Student.java
  57. 274 0
      src/main/java/com/sf/sx2/Te2.java
  58. BIN
      target/classes/com/sf/day03/T.class
  59. BIN
      target/classes/com/sf/day06/Cat.class
  60. BIN
      target/classes/com/sf/day06/Mouse.class
  61. BIN
      target/classes/com/sf/day06/Person.class
  62. BIN
      target/classes/com/sf/day06/PersonTest.class
  63. BIN
      target/classes/com/sf/day06/Student.class
  64. BIN
      target/classes/com/sf/day06/Te.class
  65. BIN
      target/classes/com/sf/day06/entend/Animal.class
  66. BIN
      target/classes/com/sf/day06/entend/Cat.class
  67. BIN
      target/classes/com/sf/day06/entend/CreditCard.class
  68. BIN
      target/classes/com/sf/day06/entend/DepositCard.class
  69. BIN
      target/classes/com/sf/day06/entend/Mouse.class
  70. BIN
      target/classes/com/sf/quanrizhi/T.class
  71. BIN
      target/classes/com/sf/quanrizhi/day01/Column.class
  72. BIN
      target/classes/com/sf/quanrizhi/day01/Data.class
  73. BIN
      target/classes/com/sf/quanrizhi/day01/MyPredicate.class
  74. BIN
      target/classes/com/sf/quanrizhi/day01/Product.class
  75. BIN
      target/classes/com/sf/quanrizhi/day01/Student.class
  76. BIN
      target/classes/com/sf/quanrizhi/day01/Student1.class
  77. BIN
      target/classes/com/sf/quanrizhi/day01/T$1.class
  78. BIN
      target/classes/com/sf/quanrizhi/day01/T$2.class
  79. BIN
      target/classes/com/sf/quanrizhi/day01/T$3.class
  80. BIN
      target/classes/com/sf/quanrizhi/day01/T.class
  81. BIN
      target/classes/com/sf/quanrizhi/day01/Table.class
  82. BIN
      target/classes/com/sf/quanrizhi/day01/User.class
  83. BIN
      target/classes/com/sf/quanrizhi/day02/Te$1.class
  84. BIN
      target/classes/com/sf/quanrizhi/day02/Te$2.class
  85. BIN
      target/classes/com/sf/quanrizhi/day02/Te.class
  86. BIN
      target/classes/com/sf/quanrizhi/day02/User.class
  87. BIN
      target/classes/com/sf/quanrizhi/day03/TE.class
  88. BIN
      target/classes/com/sf/sx/day01/Te.class
  89. BIN
      target/classes/com/sf/sx/day02/TE.class
  90. BIN
      target/classes/com/sf/sx/day03/Te.class
  91. BIN
      target/classes/com/sf/sx/day04/BSX.class
  92. BIN
      target/classes/com/sf/sx/day04/Car.class
  93. BIN
      target/classes/com/sf/sx/day04/DP.class
  94. BIN
      target/classes/com/sf/sx/day04/FDJ.class
  95. BIN
      target/classes/com/sf/sx/day04/Person.class
  96. BIN
      target/classes/com/sf/sx/day04/PersonUtils.class
  97. BIN
      target/classes/com/sf/sx/day04/Student.class
  98. BIN
      target/classes/com/sf/sx/day04/TE.class
  99. BIN
      target/classes/com/sf/sx/day04/l2/Cat.class
  100. BIN
      target/classes/com/sf/sx/day04/l2/Mouse.class

+ 0 - 1
src/main/java/com/sf/day03/T.java

@@ -1,6 +1,5 @@
 package com.sf.day03;
 
-import com.sf.quanrizhi.day03.TE;
 import org.junit.Test;
 
 public class T {

+ 23 - 10
src/main/java/com/sf/sx/day04/l2/Cat.java → src/main/java/com/sf/day06/Cat.java

@@ -1,7 +1,7 @@
-package com.sf.sx.day04.l2;
+package com.sf.day06;
 
 public class Cat {
-    private  String name;
+    private String name;
     private Integer id;
 
     public Cat() {
@@ -28,6 +28,22 @@ public class Cat {
         this.id = id;
     }
 
+    /**
+     * 捉老鼠
+     */
+    public void catchMouse(){
+        System.out.println("catchMouse");
+
+    }
+
+    public void eat(){
+        System.out.println("eat~");
+    }
+
+    public void sleep(){
+        System.out.println("sleep~");
+    }
+
     @Override
     public String toString() {
         return "Cat{" +
@@ -36,15 +52,12 @@ public class Cat {
                 '}';
     }
 
-    public void eat(String name){
-        System.out.println(name+"eat~");
+    public String info(){
+        return "Cat{" +
+                "name='" + name + '\'' +
+                ", id=" + id +
+                '}';
     }
 
-    public void sleep(String name){
-        System.out.println(name+"sleep~");
-    }
 
-    public void catchMouse(String name){
-        System.out.println(name+"catchMouse~");
-    }
 }

+ 77 - 0
src/main/java/com/sf/day06/Mouse.java

@@ -0,0 +1,77 @@
+package com.sf.day06;
+
+public class Mouse {
+
+    private String name;
+    private Integer id;
+
+
+
+    public Mouse() {
+    }
+
+    public Mouse(String name, Integer id) {
+        this.name = name;
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public void eat(){
+        System.out.println("eat~");
+    }
+
+    public void sleep(){
+        System.out.println("sleep~");
+    }
+
+    @Override
+    public String toString() {
+        return "Cat{" +
+                "name='" + name + '\'' +
+                ", id=" + id +
+                '}';
+    }
+
+    public String info(){
+        return "Cat{" +
+                "name='" + name + '\'' +
+                ", id=" + id +
+                '}';
+    }
+
+
+    public void play(){
+        System.out.println("play~");
+    }
+
+
+    public static void main(String[] args) {
+        Cat cat = new Cat();
+        cat.setId(1);
+        cat.setName("小猫");
+        String info = cat.info();
+        System.out.println(info);
+
+
+        Mouse mouse = new Mouse();
+        mouse.setId(1);
+        mouse.setName("老鼠");
+        String info1 = mouse.info();
+        System.out.println(info1);
+    }
+}

+ 70 - 0
src/main/java/com/sf/day06/Person.java

@@ -0,0 +1,70 @@
+package com.sf.day06;
+
+
+/**
+ * 封装
+ */
+public class Person {
+    /**
+     * javaBean  属性 方法 构造器  getset方法  toString()
+     */
+    private String name;
+    private Integer age;  ///int    integer
+    private Double height;
+    private Double weight;
+    public Person(){
+
+    }
+
+    public Person(String name,Integer age,Double height,Double weight){
+        this.name = name;
+        this.age = age;
+        this.height = height;
+        this.weight = weight;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        if(age < 0){
+            this.age = 10;
+        }else
+        this.age = age;
+    }
+
+    public Double getHeight() {
+        return height;
+    }
+
+    public void setHeight(Double height) {
+        this.height = height;
+    }
+
+    public Double getWeight() {
+        return weight;
+    }
+
+    public void setWeight(Double weight) {
+        this.weight = weight;
+    }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                ", height=" + height +
+                ", weight=" + weight +
+                '}';
+    }
+}

+ 13 - 0
src/main/java/com/sf/day06/PersonTest.java

@@ -0,0 +1,13 @@
+package com.sf.day06;
+
+public class PersonTest {
+
+    public static void main(String[] args) {
+        Person person = new Person();
+        person.setName("lisa");
+        person.setAge(18);
+        person.setHeight(180.0);
+        person.setWeight(123.4);
+        System.out.println(person);
+    }
+}

+ 85 - 0
src/main/java/com/sf/day06/Student.java

@@ -0,0 +1,85 @@
+package com.sf.day06;
+
+import java.util.Arrays;
+
+public class Student {
+    public int number;
+    public int state;
+    public int score;
+
+    /**
+     * 构造器
+     * 权限修饰符  类名(){
+     *
+     * }
+     * @return
+     *  当前类没有构造器  系统会默认添加午无参构造器
+     *  构造器的作用:
+     *  1、对象的创建
+     *  2、属性的赋值
+     */
+
+    public Student(){
+
+    }
+
+    public Student(int number,int score,int state){
+        this(number,score);
+        this.state = state;
+
+    }
+
+    public Student(int number,int score){
+        this.number = number;
+//        this.state = state;
+        this.score = score;
+
+    }
+
+    public Student(int number){
+        this.number = number;
+    }
+    @Override
+    public String toString() {
+        return "Student{" +
+                "number=" + number +
+                ", state=" + state +
+                ", score=" + score +
+                '}';
+    }
+
+
+    public static void main(String[] args) {
+        Student[] students = new Student[5];
+        for (int i= 0;i<students.length;i++){
+            Student student = new Student();
+            student.number = i+1;
+            student.state = i+1;
+            student.score = (int) (Math.random()*100)+1;
+            students[i] = student;
+        }
+        System.out.println(Arrays.toString(students));
+        Student infoByState = getInfoByState(students);
+        System.out.println(infoByState);
+
+        System.out.println(Arrays.toString(students));
+    }
+
+    /**
+     * 获取年纪为3的学生信息
+     * @param student
+     * @return
+     */
+    public static  Student getInfoByState(Student[] student){
+        for (Student student1 : student) {
+            if(student1.state == 3){
+                return student1;
+            }
+        }
+        return null;
+    }
+
+
+
+
+}

+ 11 - 0
src/main/java/com/sf/day06/Te.java

@@ -0,0 +1,11 @@
+package com.sf.day06;
+
+import org.junit.Test;
+
+public class Te {
+    @Test
+    public void t1(){
+        Student student = new Student(1,2,3);
+        System.out.println(student);
+    }
+}

+ 22 - 15
src/main/java/com/sf/sx/day04/l2/extend/Animal.java → src/main/java/com/sf/day06/entend/Animal.java

@@ -1,20 +1,20 @@
-package com.sf.sx.day04.l2.extend;
+package com.sf.day06.entend;
 
 /**
- * 父类
+ * 这是小猫 老鼠的父类
  */
 public class Animal {
-    private  String name;
+    private String name;
     private Integer id;
 
+    public Animal() {
+    }
+
     public Animal(String name, Integer id) {
         this.name = name;
         this.id = id;
     }
 
-    public Animal() {
-    }
-
     public String getName() {
         return name;
     }
@@ -31,19 +31,26 @@ public class Animal {
         this.id = id;
     }
 
+    public void eat(String name){
+        System.out.println(name + "eat~");
+    }
+
+    public void sleep(String name){
+        System.out.println(name + "sleep~");
+    }
+
+
+    public String info() {
+        return "Animal{" +
+                "name='" + name + '\'' +
+                ", id=" + id +
+                '}';
+    }
     @Override
     public String toString() {
-        return "Cat{" +
+        return "Animal{" +
                 "name='" + name + '\'' +
                 ", id=" + id +
                 '}';
     }
-
-    public void eat(String name){
-        System.out.println(name+"eat~");
-    }
-
-    public void sleep(String name){
-        System.out.println(name+"sleep~");
-    }
 }

+ 33 - 0
src/main/java/com/sf/day06/entend/Cat.java

@@ -0,0 +1,33 @@
+package com.sf.day06.entend;
+
+public class Cat extends Animal{
+
+
+    /**
+     * 小猫自己特有的方法
+     */
+
+    public void catchMouse(){
+        System.out.println("小猫捉老鼠~");
+    }
+
+
+    @Override
+    public void eat(String name) {
+        System.out.println("小猫吃的方法被重写~");
+    }
+
+    @Override
+    public void sleep(String name) {
+        System.out.println("小猫sleep的方法被重写~");
+    }
+
+    public static void main(String[] args) {
+        Mouse mouse = new Mouse();
+        mouse.setId(1);
+        mouse.setName("老鼠");
+        mouse.play();
+        mouse.eat(mouse.getName());
+        System.out.println(mouse);
+    }
+}

+ 110 - 0
src/main/java/com/sf/day06/entend/CreditCard.java

@@ -0,0 +1,110 @@
+package com.sf.day06.entend;
+
+import javax.swing.*;
+
+public class CreditCard extends DepositCard{
+
+//  本月可透支总额度,本月已透支金额
+
+    private  double totalMoney;  //可透支总额度
+    private  double overMoney;   //已透支金额
+
+    public CreditCard() {
+    }
+
+    public CreditCard(double totalMoney, double overMoney) {
+        this.totalMoney = totalMoney;
+        this.overMoney = overMoney;
+    }
+
+
+    public double getTotalMoney() {
+        return totalMoney;
+    }
+
+    public void setTotalMoney(double totalMoney) {
+        this.totalMoney = totalMoney;
+    }
+
+    public double getOverMoney() {
+        return overMoney;
+    }
+
+    public void setOverMoney(double overMoney) {
+        this.overMoney = overMoney;
+    }
+
+    @Override
+    public String toString() {
+        return "CreditCard{" +
+                "totalMoney=" + totalMoney +
+                ", overMoney=" + overMoney +
+                '}';
+    }
+
+
+    /**
+     * 取款金额超过账户余额+本月还可透支额度,提示超过可透支额度
+     *   - 取款金额在账户余额范围内,不用透支
+     *   - 取款金额超过账户余额但在可透支范围内,需要透支
+     * @param money
+     */
+    @Override
+    public void withdraw(double money) {
+        if(money > getBalance()+totalMoney-overMoney){
+            System.out.println("超过可透支额度~");
+            return;
+        }
+        if(money <=getBalance()  ){
+            super.withdraw(money);
+            return;
+        }
+      overMoney  +=  money - getBalance();
+        //   将余额清零
+        setBalance(0.0);
+    }
+
+    /**
+     * 存款金额不能为负数,否则提示存款金额不能为负数
+     *   - 本次存款金额只够偿还部分已透支金额
+     *   - 本次存款金额除了偿还透支金额,还有剩余
+     * @param money
+     */
+    public void save(double money){
+        if(money < 0){
+            System.out.println("提示存款金额不能为负数");
+            return;
+        }
+
+        if(money <= overMoney){
+            overMoney -= money;
+            return;
+        }
+
+        //  偿还完已透支  还有余额
+        setBalance(getBalance() +(money - overMoney) );
+        // 把透支清零
+        overMoney = 0.0;
+    }
+
+
+    public static void main(String[] args) {
+        DepositCard depositCard = new DepositCard();
+        depositCard.setId("1");
+        depositCard.setBalance(1000.0);
+
+//        System.out.println(depositCard);
+//        depositCard.withdraw(200);
+//        depositCard.withdraw(900);
+//        System.out.println(depositCard);
+
+        CreditCard creditCard = new CreditCard();
+        creditCard.setTotalMoney(500);
+        creditCard.setBalance(1000.0);
+        creditCard.withdraw(1400);
+        System.out.println(creditCard);
+    }
+
+
+
+}

+ 72 - 0
src/main/java/com/sf/day06/entend/DepositCard.java

@@ -0,0 +1,72 @@
+package com.sf.day06.entend;
+
+public class DepositCard {
+    private String id;
+    private Double balance;
+
+    public DepositCard() {
+    }
+
+    public DepositCard(String id, Double balance) {
+        this.id = id;
+        this.balance = balance;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Double getBalance() {
+        return balance;
+    }
+
+    public void setBalance(Double balance) {
+        this.balance = balance;
+    }
+
+    @Override
+    public String toString() {
+        return "DepositCard{" +
+                "id='" + id + '\'' +
+                ", balance=" + balance +
+                '}';
+    }
+
+    /**
+     * 取款
+     * @param money
+     */
+    public void withdraw(double money){
+     if(money < 0 ){
+         System.out.println("取款金额不能为负数~");
+     }else if (money > balance){
+         System.out.println("取款金额不能大于余额");
+     }else {
+         balance -= money;
+     }
+    }
+
+    /**
+     * 存款
+     * @param money
+     */
+    public void save(double money){
+        if(money <0){
+            System.out.println("存款不能为负数~");
+        }else {
+            balance += money;
+        }
+    }
+
+    public String getInfo() {
+        return "DepositCard{" +
+                "id='" + id + '\'' +
+                ", balance=" + balance +
+                '}';
+    }
+
+}

+ 30 - 0
src/main/java/com/sf/day06/entend/Mouse.java

@@ -0,0 +1,30 @@
+package com.sf.day06.entend;
+
+public class Mouse extends Animal{
+
+    @Override
+    public void eat(String name) {
+        System.out.println("老鼠在吃");
+    }
+
+    public void play(){
+        System.out.println("老鼠在打洞~");
+
+    }
+
+    public static void main(String[] args) {
+        Cat cat = new Cat();
+        cat.setId(1);
+        cat.setName("小猫咪~");
+        cat.eat(cat.getName());
+        cat.sleep(cat.getName());
+        cat.catchMouse();
+        System.out.println(cat);
+    }
+
+
+
+
+
+
+}

+ 0 - 64
src/main/java/com/sf/quanrizhi/T.java

@@ -1,64 +0,0 @@
-package com.sf.quanrizhi;
-
-import org.junit.Test;
-
-public class T {
-
-    @Test
-    public void t1(){
-     byte num = 0;
-     long num2 = 120l;
-     float num3 = 12.3F;
-     double num4 = 12.3D;
-     char a = 'A';
-        /**
-         * A = 65  a~z    以此类推
-         * a = 97
-         */
-     int aa = (int)a;
-        System.out.println(aa);
-        int love = 13;
-        char love1 = (char) love;
-        System.out.println(love1);
-        long num5 = 12;
-        byte num6 = (byte) 129;
-       String str = num + "";
-        short s = 3;
-        s += 3;  //s = s + 3
-//        s = s+3;
-
-//        short n = 12;
-
-        System.out.println(10 & 3);
-        System.out.println(12 | 16);
-    }
-
-    @Test
-    public void t2(){
-    // 获取三个数中的较大数  6,9, 7
-        int num = (6>1)?6:9;
-        System.out.println(num);
-    }
-
-    @Test
-    public void t3(){
-    int num1 = 6;
-    int num2 = 9;
-    int num3 = 7;
-      num1  =  (num1>num2)?num1:num2;
-      num1=  (num1>num3)?num1:num3;
-        System.out.println(num1);
-
-
-    }
-
-    @Test
-    public void t4(){
-        int num1 = 6;
-        int num2 = 9;
-        int num3 = 7;
-        num1  =  ((num2 =(num1>num2)?num1:num2)>num3)?num2:num3;
-        System.out.println(num1);
-    }
-
-}

+ 0 - 14
src/main/java/com/sf/quanrizhi/day01/Column.java

@@ -1,14 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-import jdk.internal.org.objectweb.asm.tree.analysis.Value;
-
-import java.lang.annotation.*;
-import java.util.Vector;
-
-@Inherited
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Column {
-    String columnName();
-    String columnType();
-}

+ 0 - 15
src/main/java/com/sf/quanrizhi/day01/Data.java

@@ -1,15 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Data {
-    public static  List<Product> products = new ArrayList<>();
-    static {
-        products.add(new Product(1L, "苹果手机", 8888.88,"手机"));
-        products.add(new Product(2L, "华为手机", 6666.66,"手机"));
-        products.add(new Product(3L, "联想笔记本",7777.77,"电脑"));
-        products.add(new Product(4L, "机械键盘", 999.99,"键盘"));
-        products.add(new Product(5L, "雷蛇鼠标", 222.22,"鼠标"));
-    }
-}

+ 0 - 5
src/main/java/com/sf/quanrizhi/day01/MyPredicate.java

@@ -1,5 +0,0 @@
-package com.sf.quanrizhi.day01;
-@FunctionalInterface
-public interface MyPredicate {
-    boolean test(Product product);
-}

+ 0 - 60
src/main/java/com/sf/quanrizhi/day01/Product.java

@@ -1,60 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-public class Product {
-    private Long    id;         // 序号
-    private String  name;       // 商品名称
-    private Double 	price;      // 价格
-    private String  type;       // 类型
-
-    public Product() {
-    }
-
-    public Product(Long id, String name, Double price, String type) {
-        this.id = id;
-        this.name = name;
-        this.price = price;
-        this.type = type;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Double getPrice() {
-        return price;
-    }
-
-    public void setPrice(Double price) {
-        this.price = price;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    @Override
-    public String toString() {
-        return "Product{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                ", price=" + price +
-                ", type='" + type + '\'' +
-                '}';
-    }
-}

+ 0 - 46
src/main/java/com/sf/quanrizhi/day01/Student.java

@@ -1,46 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-public class Student {
-    private Integer id;
-    private String name;
-
-    public Student() {
-    }
-
-    public Student(Integer id, String name) {
-        this.id = id;
-        this.name = name;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String toString() {
-        return "Student{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                '}';
-    }
-
-    public static void printInfo(String name){
-        System.out.println("这是静态方法name ="+name);
-    }
-
-    public static void main(String[] args) {
-        printInfo("name");
-    }
-}

+ 0 - 44
src/main/java/com/sf/quanrizhi/day01/Student1.java

@@ -1,44 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-/**
- * SELECT   id , name  FROM  Student
- */
-@Table(value = "student")
-public class Student1 {
-    @Column(columnName = "sid",columnType = "int")
-    private int id;
-    @Column(columnName = "sname",columnType ="varchar(25)" )
-    private String name;
-
-    public Student1() {
-    }
-
-    public Student1(int id, String name) {
-        this.id = id;
-        this.name = name;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String toString() {
-        return "Student1{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                '}';
-    }
-}

+ 0 - 385
src/main/java/com/sf/quanrizhi/day01/T.java

@@ -1,385 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-public class T {
-    @Test
-    public void t1() throws ClassNotFoundException {
-        //  1
-        Class<User> userClass = User.class;
-
-        //2
-        User user = new User();
-        Class<? extends User> aClass = user.getClass();
-        //3
-        Class<?> aClass1 = Class.forName("com.sf.quanrizhi.day01.User");
-
-        //4
-        ClassLoader classLoader = this.getClass().getClassLoader();
-        Class<?> aClass2 = classLoader.loadClass("com.sf.quanrizhi.day01.User");
-    }
-
-    @Test
-    public void t2() throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException {
-        Class<?> clazz = Class.forName("com.sf.quanrizhi.day01.Student");
-        Object o = clazz.newInstance();
-        Student student = null;
-        if(o instanceof Student){
-             student = (Student) o;
-        }
-        System.out.println(student);
-        String str = "com.sf.reflectiontest.Student";
-//        Class<?> clazz = Class.forName(str);
-//        Object o = clazz.newInstance();
-        System.out.println((Student)o);
-        String name = clazz.getName();
-        System.out.println(name);
-        System.out.println(clazz.getSuperclass());
-        System.out.println(Arrays.toString(clazz.getInterfaces()));
-        ClassLoader classLoader = clazz.getClassLoader();
-        System.out.println(classLoader);
-        System.out.println(Arrays.toString(clazz.getConstructors()));
-        System.out.println(Arrays.toString(clazz.getDeclaredMethods()));
-        System.out.println(Arrays.toString(clazz.getMethods()));
-        System.out.println(clazz.getMethod("setId",Integer.class));
-    }
-
-    @Test
-    public void t3(){
-        Class c1 = Object.class;
-        Class c2 = Comparable.class;
-        Class c3 = String[].class;
-        Class c4 = int[][].class;
-        Class c5 = ElementType.class;
-        Class c6 = Override.class;
-        Class c7 = int.class;
-        Class c8 = void.class;
-        Class c9 = Class.class;
-
-        int[] a = new int[10];
-        int[] b = new int[100];
-        Class c10 = a.getClass();
-        Class c11 = b.getClass();
-// 只要元素类型与维度一样,就是同一个Class
-        System.out.println(c10 == c11);
-    }
-
-    //总结:
-    /**
-     * getField("pName");   获取属性  包含父类 (public)
-     * getFields():获得某个类的所有的公共(public)的字段,包括父类中的字段。
-     * getDeclaredFields():获得当前类的所有声明的字段,不包含父类  即包括public、private和proteced,
-     *
-     * getConstructors()   获取当前类的构造器(public)
-     * getDeclaredConstructors()   获取当前类的构造器(所有声明的)
-     *
-     * getMethods是获取类中所有公共方法,包括继承自父类的
-     * getDeclaredMethods是获取类中自己声明的方法,即自己声明的任何权限的方法,包括私有方法  不包含父类方法
-     */
-
-    @Test
-    public void test01(){
-        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
-        System.out.println("systemClassLoader = " + systemClassLoader);
-    }
-
-    @Test
-    public void test02()throws Exception{
-        ClassLoader c1 = String.class.getClassLoader();
-        System.out.println("加载String类的类加载器:" + c1);
-
-        ClassLoader c2 = T.class.getClassLoader();
-        System.out.println("加载当前类的类加载器:" + c2);
-    }
-
-    @Test
-    public void test03(){
-        ClassLoader c1 = T.class.getClassLoader();
-        System.out.println("加载当前类的类加载器c1=" + c1);
-
-        ClassLoader c2 = c1.getParent();
-        System.out.println("c1.parent = " + c2);
-
-        ClassLoader c3 = c2.getParent();
-        System.out.println("c2.parent = " + c3);
-
-    }
-
-    /**
-     * 使用ClassLoader获取流
-     */
-    @Test
-    public void test04() throws IOException {
-        InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("jdbc.properties");
-        Properties properties = new Properties();
-        properties.load(resourceAsStream);
-        String name = properties.getProperty("name");
-        String password = properties.getProperty("password");
-        System.out.println(name);
-        System.out.println(password);
-    }
-
-    @Test
-    public void test1() throws Exception{
-//        LcClass obj = new lLClass();//编译期间无法创建
-
-        Class<?> clazz = Class.forName("com.lc.demo.LcClass");
-        //clazz代表com.lc.demo.LcClass类型
-        //clazz.newInstance()创建的就是LcClass的对象
-        Object obj = clazz.newInstance();
-        System.out.println(obj);
-    }
-
-    @Test
-    public void test2()throws Exception{
-        Class<?> clazz = Class.forName("com.lc.demo.LcDemo");
-        //java.lang.InstantiationException: com.lc.demo.LcDemo
-        //Caused by: java.lang.NoSuchMethodException: com.lc.demo.LcDemo.<init>()
-        //即说明lcDemo没有无参构造,就没有无参实例初始化方法<init>
-        Object o = clazz.newInstance();
-        System.out.println(o);
-    }
-
-    @Test
-    public void test3()throws Exception{
-        //(1)获取Class对象
-        Class<?> clazz = Class.forName("com.lc.demo.LcDemo");
-        /*
-         * 获取lcDemo类型中的有参构造
-         * 如果构造器有多个,我们通常是根据形参【类型】列表来获取指定的一个构造器的
-         * 例如:public LcDemo(String title, int num)
-         */
-        //(2)获取构造器对象
-        Constructor<?> constructor = clazz.getDeclaredConstructor(String.class,int.class);
-
-        //(3)创建实例对象
-        // T newInstance(Object... initargs)  这个Object...是在创建对象时,给有参构造的实参列表
-        Object obj = constructor.newInstance("爱扣钉",2022);
-        System.out.println(obj);
-    }
-
-
-    /**
-     * 通过反射的形式对当前Student类进行赋值
-     */
-    @Test
-    public void t5() throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
-        // 获取student对象的class对象
-        Class<?> clazz = Class.forName("com.sf.quanrizhi.day01.Student");
-        //获取对象属性
-        Field idFiled = clazz.getDeclaredField("id");
-        //取消java语言访问权限
-        idFiled.setAccessible(true);
-        //创建student的实例对象
-        Object stu = clazz.newInstance();
-        //获取属性值
-        Object o = idFiled.get(stu);
-        System.out.println(o);
-
-        //操作当前属性值
-        idFiled.set(stu,120);
-
-        System.out.println(idFiled.get(stu));
-    }
-
-
-    /**
-     * 通过反射的形式去操作方法
-     */
-    @Test
-    public void t7() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
-        Class<?> clazz = Class.forName("com.sf.quanrizhi.day01.Student");
-        Method setNameMethod = clazz.getDeclaredMethod("setName", String.class);
-        //实例化对象
-        Object obj = clazz.newInstance();
-
-        Object objectMethod = setNameMethod.invoke(obj, "zhangsan");
-        System.out.println(objectMethod);  //null
-        //掉用方法获取设置值   获取getName方法
-        Method getName = clazz.getDeclaredMethod("getName");
-        Object invoke = getName.invoke(obj);
-        System.out.println(invoke);
-    }
-
-    @Test
-    public void t8() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-//        Student.printInfo();
-        Class<?> clazz = Class.forName("com.sf.quanrizhi.day01.Student");
-        Method printInfo = clazz.getMethod("printInfo",String.class);
-        printInfo.invoke(null,"zs");
-    }
-
-    @Test
-    public void t9() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
-        InputStream resourceAsStream = ClassLoader.getSystemClassLoader().getResourceAsStream("user.properties");
-        Properties properties = new Properties();
-        properties.load(resourceAsStream);
-        String className = properties.getProperty("className");
-        String methodName = properties.getProperty("methodName");
-        Class<?> clazz = Class.forName(className);
-        Object o = clazz.newInstance();
-        Method method = clazz.getMethod(methodName);
-        Object invoke = method.invoke(o);
-        System.out.println(invoke);
-    }
-
-    @Test
-    public void t10(){
-        Class<Student1> student1Class = Student1.class;
-        Table annotation = student1Class.getAnnotation(Table.class);
-        String tableName = "";
-        if(annotation !=null){
-             tableName = annotation.value();
-        }
-        Field[] declaredFields = student1Class.getDeclaredFields();
-        String[] columns= new String[declaredFields.length];
-        int index = 0;
-        for (Field declaredField : declaredFields) {
-            Column annotation1 = declaredField.getAnnotation(Column.class);
-            if(annotation1 != null){
-                columns[index++]= annotation1.columnName();
-            }
-        }
-        String sql  = "SELECT ";
-        for (int i = 0;i<index;i++){
-            sql += columns[i];
-            if(i<index-1){
-                sql+=",";
-            }
-        }
-        sql += "   FROM "+tableName;
-        System.out.println(sql);
-    }
-
-    /**
-     * 通过反射
-     * 像List<String> 集合中添加整型int
-     *
-     */
-    @Test
-    public void t11() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        //创建list集合
-        List<String>  list = new ArrayList<>();
-        //应该获取Arraylist 的class对象
-        Class<? extends List> listClass = list.getClass();
-        Method add = listClass.getMethod("add", Object.class);
-        add.invoke(list,1);
-        add.invoke(list,"hello");
-        add.invoke(list,true);
-        System.out.println(list);
-    }
-
-
-    @Test
-    public void t12(){
-        //启动一个线程 并且输出一句话
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                System.out.println("开启一个新的线程!!");
-            }
-        }).start();
-
-        new Thread(() -> System.out.println("开启一个新的线程!!")).start();
-    }
-
-    /**
-     * 筛选出所有名称包含手机的商品
-     */
-    @Test
-    public void t13(){
-        List<Product> productsWithName = findProductsWithName(Data.products);
-        System.out.println(productsWithName);
-
-        //  筛选出价格大于1000的商品
-        List<Product> productsWithPrice = findProductsWithPrice(Data.products);
-        System.out.println(productsWithPrice);
-    }
-
-    public static List<Product> findProductsWithName(List<Product> products){
-        List<Product> list = new ArrayList<>();
-        for (Product p : products) {
-            if(p.getName().contains("手机")){
-                list.add(p);
-            }
-        }
-        return list;
-    }
-
-    public static List<Product> findProductsWithPrice(List<Product> products){
-        List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(product.getPrice() > 1000){
-                list.add(product);
-            }
-        }
-        return list;
-    }
-
-
-    @Test
-    public void t14(){
-    // 筛选出名称种包含手机的商品
-        List<Product> productsWithCondition = findProductsWithCondition(Data.products, new MyPredicate() {
-            @Override
-            public boolean test(Product product) {
-                return  product.getName().contains("手机");
-            }
-        });
-        System.out.println(productsWithCondition);
-
-        List<Product> productsWithCondition1 = findProductsWithCondition(Data.products, new MyPredicate() {
-            @Override
-            public boolean test(Product product) {
-                return product.getPrice() > 1000;
-            }
-        });
-        System.out.println(productsWithCondition1);
-
-
-    }
-
-    public static List<Product> findProductsWithCondition(List<Product> products ,MyPredicate condition){
-        List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(condition.test(product)){
-                list.add(product);
-            }
-        }
-        return list;
-    }
-
-
-    @Test
-    public void t16(){
-        findPhoneByCondition(Data.products,(product ->
-             product.getName().contains("手机")
-        ));
-
-        // 价格
-        findPhoneByCondition(Data.products,(product -> product.getPrice()>1000));
-    }
-
-    public static List<Product> findPhoneByCondition(List<Product> products,MyPredicate myPredicate){
-        List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(myPredicate.test(product)){
-                list.add(product);
-            }
-        }
-        return list;
-    }
-
-}

+ 0 - 14
src/main/java/com/sf/quanrizhi/day01/Table.java

@@ -1,14 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-import java.lang.annotation.*;
-
-@Inherited     //子类可以被继承
-@Target(ElementType.TYPE)   //定义在类上
-@Retention(RetentionPolicy.RUNTIME)  //生命周期   运行时
-public @interface Table {
-    String value();
-    /**
-     * 为什么要这么定义
-     * 背景:我们通过注解写一个sql语句  select 字段...  from  user
-     */
-}

+ 0 - 34
src/main/java/com/sf/quanrizhi/day01/User.java

@@ -1,34 +0,0 @@
-package com.sf.quanrizhi.day01;
-
-public class User {
-    private Integer id;
-    private String name;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String toString() {
-        return "User{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                '}';
-    }
-
-    public void show(){
-        System.out.println("show!!!");
-    }
-}

+ 0 - 207
src/main/java/com/sf/quanrizhi/day02/Te.java

@@ -1,207 +0,0 @@
-package com.sf.quanrizhi.day02;
-
-import com.sun.org.apache.bcel.internal.generic.IUSHR;
-import org.junit.Test;
-
-import java.io.PipedOutputStream;
-import java.sql.*;
-import java.sql.Date;
-import java.util.*;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Stream流操作
- */
-public class Te {
-
-    /**
-     * 操作1:对每个元素求平方
-     * 操作2:请找出数组中的偶数元素
-     * 操作3:对偶数进行升序排序
-     * 操作4:打印
-     */
-    @Test
-    public void t1(){
-        List<Integer> list = Arrays.asList(4, 1, 2, 3);
-        // 1   创建stream流
-        Stream<Integer> stream = list.stream();
-        // 中间操作
-        stream
-                .map(e -> e*e)
-                .filter(e -> e%2 == 0)
-                .sorted()
-                .forEach(e -> System.out.println(e));
-    }
-
-    @Test
-    public void t2(){ //  4  1 2 3
-        Arrays.asList(4, 1,1,4,2, 2, 3).stream().distinct().limit(4).skip(2).map(e -> e*e).filter(e -> e%2 ==0).sorted().forEach(e -> System.out.println(e));
-    }
-
-    @Test
-    public void t3(){
-        List<String> list = Arrays.asList("i", "love", "money");
-        list.stream()
-                .map(s->s.toUpperCase())
-                .forEach(System.out::println);
-    }
-
-    @Test
-    public void t4(){
-        List<Integer> list1 = Arrays.asList(1, 2);
-        List<Integer> list2 = Arrays.asList(3, 4, 5);
-        // 1 把两个集合存入stream流中
-        Stream<List<Integer>> listStream = Stream.of(list1, list2);
-        // 2 对把两个集合转换成Stream并进行合并
-        listStream
-                .flatMap(list->list.stream())
-                .forEach(System.out::println);
-    }
-
-
-    @Test
-    public void t5(){
-        List<Integer> list = Arrays.asList(2, 3, 7, 4, 9, 1);
-        list.stream().sorted().forEach(System.out::println);
-    }
-    @Test
-    public void t6(){
-        List<Integer> list = Arrays.asList(2, 3, 7, 4, 9, 1);
-//        list.stream().sorted((o1, o2) -> o2-o1).forEach(System.out::println);
-        list.stream().sorted(Comparator.reverseOrder()).forEach(System.out::println);
-    }
-
-
-    @Test
-    public void t7(){
-        List<Integer> list = Arrays.asList(1, 2, 1, 3, -1, 2, 4);
-        //  获取流种元素的个数
-        long count = list.stream().count();
-        System.out.println(count);
-
-        //: 获取给定一个集合中的最大值
-        Optional<Integer> max = list.stream().max(Comparator.naturalOrder());
-        Integer integer = max.get();
-        System.out.println(integer);
-
-        Integer integer1 = list.stream().min(Comparator.naturalOrder()).get();
-        System.out.println(integer1);
-    }
-
-    @Test
-    public void t8(){
-        List<Integer> list = Arrays.asList(1, 2, 1, 3, 2, 4);
-        list.stream().distinct().collect(Collectors.toList());
-        list.stream().collect(Collectors.toSet());
-
-    }
-
-    @Test
-    public void t9(){
-
-        /**
-         * 需求: 把合list进行去重后收集到Map集合中,要求: 元素作为key,元素的平方作为value
-         */
-        List<Integer> list = Arrays.asList(1, 2, 1, 3, 2, 4);
-        Map<Integer, Integer> collect = list.stream().distinct().collect(Collectors.toMap(new Function<Integer, Integer>() {
-                                                                                              @Override
-                                                                                              public Integer apply(Integer integer) {
-                                                                                                  return integer;
-                                                                                              }
-                                                                                          }, new Function<Integer, Integer>() {
-                                                                                              @Override
-                                                                                              public Integer apply(Integer integer) {
-                                                                                                  return integer * integer;
-                                                                                              }
-                                                                                          }
-        ));
-        System.out.println(collect);
-
-        // 转换成lambda表达式
-        Map<Integer, Integer> collect1 = list.stream().distinct().collect(Collectors.toMap(integer -> integer, integer -> integer * integer));
-        collect1.forEach(((k,v) -> System.out.println("key = "+k +"value = "+v) ));
-    }
-
-    @Test
-    public void t10(){
-        Integer collect = Arrays.asList(1, 2, 3, 4, 5, 6, 7).stream().map(e -> e * e).collect(Collectors.summingInt(e -> e));
-        Double collect1 = Arrays.asList(1, 2, 3, 4, 5, 6, 7).stream().map(e -> e * e).collect(Collectors.summingDouble(e -> e * 1.0));
-        Double collectavg = Arrays.asList(1, 2, 3, 4, 5, 6, 7).stream().map(e -> e * e).collect(Collectors.averagingDouble(e -> e * 1.0));
-        System.out.println(collectavg);
-    }
-
-
-    /**
-     * jdbc   - 添加
-     */
-    @Test
-    public void t11() throws ClassNotFoundException, SQLException {
-        //①加载数据库驱动
-        Class.forName("com.mysql.jdbc.Driver");
-        //②创建数据库连接
-        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbc?characterEncoding=utf-8", "root", "root");
-        //创建statement对象
-        Statement statement = connection.createStatement();
-        String sql = "INSERT INTO user (user_name,price,create_time) values ('zhangSan1011',100.12,now())";
-        int i = statement.executeUpdate(sql);
-        // 影响行数
-        System.out.println(i);
-    }
-
-    @Test
-    public void t12() throws ClassNotFoundException, SQLException {
-        // 1  加载数据库的驱动
-        List<User> users = new ArrayList<>();
-        Class<?> aClass = Class.forName("com.mysql.jdbc.Driver");
-        Connection connection = DriverManager.getConnection("jdbc:mysql:///jdbc?characterEncoding=utf-8", "root", "root");
-        Statement statement = connection.createStatement();
-        String sql = "select  * from user";
-        ResultSet resultSet = statement.executeQuery(sql);
-        while (resultSet.next()){
-            User user = new User();
-            int user_id = resultSet.getInt("user_id");
-            String user_name = resultSet.getString("user_name");
-            double price = resultSet.getDouble("price");
-            Date create_time = resultSet.getDate("create_time");
-            user.setUserId(user_id);
-            user.setUserName(user_name);
-            user.setPrice(price);
-            user.setCreateTime(create_time);
-            users.add(user);
-        }
-        System.out.println(users);
-    }
-    //  查询单个信息  自己完成
-
-    @Test
-    public void t13() throws ClassNotFoundException, SQLException {
-        //分页查询
-        // 1  加载数据库的驱动
-        List<User> users = new ArrayList<>();
-        Class<?> aClass = Class.forName("com.mysql.jdbc.Driver");
-        Connection connection = DriverManager.getConnection("jdbc:mysql:///jdbc?characterEncoding=utf-8", "root", "root");
-        Statement statement = connection.createStatement();
-        //   10条      页大小3    第二页的数据
-        //   offset = (pageNo - 1 ) * pageSize
-        String sql = "select  * from user limit 3 ,3";
-        ResultSet resultSet = statement.executeQuery(sql);
-        while (resultSet.next()){
-            User user = new User();
-            int user_id = resultSet.getInt("user_id");
-            String user_name = resultSet.getString("user_name");
-            double price = resultSet.getDouble("price");
-            Date create_time = resultSet.getDate("create_time");
-            user.setUserId(user_id);
-            user.setUserName(user_name);
-            user.setPrice(price);
-            user.setCreateTime(create_time);
-            users.add(user);
-        }
-
-        System.out.println(users);
-
-    }
-}

+ 0 - 62
src/main/java/com/sf/quanrizhi/day02/User.java

@@ -1,62 +0,0 @@
-package com.sf.quanrizhi.day02;
-
-import java.util.Date;
-
-public class User {
-    private Integer userId;
-    private String userName;
-    private Double price;
-    private Date createTime;
-
-    public User() {
-    }
-
-    public User(Integer userId, String userName, Double price, Date createTime) {
-        this.userId = userId;
-        this.userName = userName;
-        this.price = price;
-        this.createTime = createTime;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public Double getPrice() {
-        return price;
-    }
-
-    public void setPrice(Double price) {
-        this.price = price;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    @Override
-    public String toString() {
-        return "User{" +
-                "userId=" + userId +
-                ", userName='" + userName + '\'' +
-                ", price=" + price +
-                ", createTime=" + createTime +
-                '}';
-    }
-}

+ 0 - 135
src/main/java/com/sf/quanrizhi/day03/TE.java

@@ -1,135 +0,0 @@
-package com.sf.quanrizhi.day03;
-
-import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.druid.pool.DruidDataSourceFactory;
-import com.alibaba.druid.pool.DruidPooledConnection;
-import org.junit.Test;
-
-import javax.sql.DataSource;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.*;
-import java.util.Comparator;
-import java.util.Properties;
-
-public class TE {
-
-    /**
-     * PreparedStatement
-     */
-    @Test
-    public void t1() throws ClassNotFoundException, SQLException {
-    //  加载数据库的驱动
-        Class.forName("com.mysql.jdbc.Driver");
-        //创建数据库的连接
-        Connection connection = DriverManager.getConnection("jdbc:mysql:///jdbc?characterEncoding=utf-8", "root", "root");
-        //创建PreparedStatement对象
-        String  sql = "insert into user(user_name,price,create_time) values (?,?,?)";
-        PreparedStatement preparedStatement = connection.prepareStatement(sql);
-        //⑤绑定参数(参数的下标从1开始而不是像数组或者集合从0开始)
-        preparedStatement.setDouble(2,123.12);
-        preparedStatement.setString(1,"lisa");
-        preparedStatement.setDate(3,new Date(System.currentTimeMillis()));
-        int row = preparedStatement.executeUpdate();
-        System.out.println(row);
-    }
-
-
-    /**
-     * 张三给李四转账500元
-     */
-
-    @Test
-    public void t2(){
-        Connection connection = null;
-        //加载驱动
-        try {
-            Class.forName("com.mysql.jdbc.Driver");
-             connection = DriverManager.getConnection("jdbc:mysql:///jdbc?characterEncoding=utf-8", "root", "root");
-            //取消默认提交方式
-            connection.setAutoCommit(false);
-            Statement statement = connection.createStatement();
-            String sql1 = "UPDATE account SET money = money+500 WHERE account_name='z3'";
-            String sql2 = "UPDATE account SET money = money-500 WHERE account_name='l4'";
-            statement.executeUpdate(sql1);
-            //  演示存在异常
-//            int a = 1/0;
-            statement.executeUpdate(sql2);
-            //手动提交
-            connection.commit();
-        } catch (ClassNotFoundException | SQLException e) {
-            if (connection != null) {
-                try {
-                    connection.rollback();
-                } catch (SQLException ex) {
-                    throw new RuntimeException(ex);
-                }
-            }
-        }
-
-    }
-
-    @Test
-    public void t3() throws ClassNotFoundException,SQLException{
-        //执行批量处理
-        Class.forName("com.mysql.jdbc.Driver");
-       Connection connection = DriverManager.getConnection("jdbc:mysql:///jdbc?characterEncoding=utf-8", "root", "root");
-        //取消默认提交方式
-        connection.setAutoCommit(false);
-        Statement statement = connection.createStatement();
-        String sql1 = "UPDATE account SET money = money+500 WHERE account_name='z3'";
-        String sql2 = "UPDATE account SET money = money-500 WHERE account_name='l4'";
-        statement.addBatch(sql1);
-        statement.addBatch(sql2);
-        // 批量执行
-        statement.executeBatch();
-        connection.commit();
-    }
-
-    @Test
-    public void t4() throws SQLException {
-        //创建Druid的核心连接池对象DruidDataSource
-        DruidDataSource ds = new DruidDataSource();
-        //设置初始化参数
-        ds.setUrl("jdbc:mysql:///jdbc?characterEncoding=utf-8");
-        ds.setUsername("root");
-        ds.setPassword("root");
-        ds.setDriverClassName("com.mysql.jdbc.Driver");
-        //  获取数据库的连接
-        Connection connection = ds.getConnection();
-        //预编译
-        String sql = "INSERT INTO user(user_name,price,create_time) VALUES(?,?,?)";
-        PreparedStatement preparedStatement = connection.prepareStatement(sql);
-        //  动态绑定参数信息
-        preparedStatement.setString(1,"litiantian");
-        preparedStatement.setDouble(2,12.23);
-        preparedStatement.setDate(3,new Date(System.currentTimeMillis()));
-        int row = preparedStatement.executeUpdate();
-        System.out.println(row);
-
-    }
-
-    /**
-     * 通过获取文件信息的方式
-     */
-    @Test
-    public void t5() throws Exception {
-        InputStream inputStream = TE.class.getClassLoader().getResourceAsStream("db.properties");
-        Properties properties = new Properties();
-        properties.load(inputStream);
-//采用Druid提供的工厂类创建DruidDataSource对象
-        DataSource dataSource = DruidDataSourceFactory.createDataSource(properties);
-        //  获取数据库的连接
-        Connection connection = dataSource.getConnection();
-        String sql = "INSERT INTO user(user_name,price,create_time) VALUES(?,?,?)";
-        PreparedStatement preparedStatement = connection.prepareStatement(sql);
-        //  动态赋值
-        preparedStatement.setString(1,"llovecoding");
-        preparedStatement.setDouble(2,12.23);
-        preparedStatement.setDate(3,new Date(System.currentTimeMillis()));
-        int i = preparedStatement.executeUpdate();
-        System.out.println(i);
-    }
-
-
-}

+ 0 - 192
src/main/java/com/sf/sx/day01/Te.java

@@ -1,192 +0,0 @@
-package com.sf.sx.day01;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Scanner;
-
-public class Te {
-    @Test
-    public void t1(){
-        /**
-         * java?一直编程语言
-         * java的数据类型:
-         * 基本数据类型
-         * 整型: byte  short int  long
-         * 4?      使用时如何选择?
-         * 计算机最小单位 位   1字节  =  8位
-         * 字节数:1    2     4    8
-         * 表数范围:-128  127
-         *计算小狗的年龄:
-         * 计算人的年龄:
-         * byte dogAge = 5;
-         * short dogAge = 5;
-         * int dogAge = 5;
-         * long dogAge = 5;
-         * 默认   12    int
-         * 浮点型:float  double
-         *        单精度   双精度
-         *        6        8
-         *    字节    4       8
-         *    12.3   double
-         * 布尔类型 :boolean    true   false
-         * 字符:char
-         * 引用数据类型:
-         * 数组   类   接口    String
-         *
-         *
-         *
-         * 循环:  for   while    do while
-         * switch  case  default  --   if    else
-         *
-         * while(条件表达式){
-         *    代码体
-         * }
-         *  do {
-         *
-         *  }while();
-         *
-         *
-         */
-        byte num = (byte) 129;
-        long num4 = 12L;
-        long num5 = 12;
-        float num1  = 12.3F;
-//      float num11  = 12.3f;
-        double num2 =12.3D;
-
-    }
-
-
-    @Test
-    public void t2(){
-    //  循环:  for   while    do while
-        //  1-100之和
-        short  sum = 0;
-        for (short i = 1;i<=100;i++){
-//   教学         sum = sum +i;
-            // 开发
-            sum += i;  // sum = sum +i;
-        }
-
-        System.out.println(sum);
-    }
-
-    /**
-     * 自己随意给定一个四位数,然后输出每位数字之和例如:
-     *  int j = 1234;
-     *  控制台打印: 和是10
-     */
-    @Test
-    public void t3(){
-    //  从键盘输入一个数,然后输出每位数字之和例如:
-    }
-
-    public static void main(String[] args) {
-        //  从键盘输入一个数,然后输出每位数字之和例如:
-        Scanner scanner = new Scanner(System.in);
-        int num = scanner.nextInt();
-        //获取各个位数
-        int gw = num%10;
-        int sw = num/10%10;
-        int bw = num/100%10;
-        int qw = num/1000;
-        int sum = gw+sw+bw+qw;
-        System.out.println(sum);
-    }
-
-    @Test
-    public void t5(){
-       // 自己随意给定3个整数,编程求出最大值(请分别用三元运算符和if选择结 实现
-        /**
-         * 三目运算符   三元运算符
-         * 语法结构:  (条件表达式)?返回值1:返回值2;
-         * int c = (6>9)?6:9;
-         * int a  = 10;
-         * int b  = 19;
-         * int c  = 14;
-         *int maxValue = ((a=(a>b)?a:b)>c)?a:c;
-         */
-    }
-    @Test
-    public void t6(){
-        /**
-         * 自己给定一个月份,输出它是哪个季节
-         *  3-5月为春季、6-8月为夏季、9-11月为秋季、12-2月为冬季
-         *  请使用switch实现
-         */
-        int season =6;
-        switch (season){
-            case 3:
-            case 4:
-            case 5:
-                System.out.println("spring");
-                break;
-            case 6:
-            case 7:
-            case 8:
-                System.out.println("summer");
-//                break;
-            case 9:
-            case 10:
-            case 11:
-                System.out.println("autumn");
-//                break;
-            case 12:
-            case 1:
-            case 2:
-                System.out.println("winter");
-//                break;
-            default:
-                System.out.println("输入有误,请重新输入!!!");
-        }
-    }
-
-    @Test
-    public void t01(){
-        //  遍历1-100内的偶数  并获取偶数的个数获取所有偶数的和
-        int count = 0;
-        int sum = 0;
-        for (int i = 1;i<=100;i++){
-            if(i % 2 == 0){
-                count++;
-                sum += i;
-            }
-        }
-
-        System.out.println(count);
-        System.out.println(sum);
-    }
-
-
-    @Test
-    public void t02(){
-    //  定义一个字符串的数组  5
-        /**
-         *                 0       1     2       3       4
-         */
-        String[] strs = {"hello","world","Hi","goodbye","money"};
-        String[] strs1 = new String[]{"hello","world","Hi","goodbye","money"};
-        String[] strs2 = new String[8];
-        strs2[0] = "qq";
-        System.out.println(Arrays.toString(strs));
-        // ["hello","world","Hi","goodbye","money"]
-        /**
-         * Arrays.toString
-         */
-        System.out.println(strs[5]);
-    }
-
-    @Test
-    public void t12(){
-        /**
-         * javase:java基础
-         *
-         *
-         *
-         *
-         * javaee:
-         *
-         *
-         */
-    }
-}

+ 0 - 81
src/main/java/com/sf/sx/day02/TE.java

@@ -1,81 +0,0 @@
-package com.sf.sx.day02;
-
-
-import java.util.Scanner;
-
-public class TE {
-    public static void main(String[] args) {
-        /**
-         * 从键盘输入
-         * java    java   until  Scanner
-         * 整型    字符串     Boolean  double
-         */
-//        Scanner scanner = new Scanner(System.in);
-//        System.out.println("请输入一个字符串");
-//        String str = scanner.next();
-//        System.out.println(str);
-//        System.out.println("请输入一个整型");
-//        int nextInt = scanner.nextInt();
-//        System.out.println(nextInt);
-        /**
-         * ATM取款**
-         *
-         * 声明变量balance并初始化为0,用以表示银行账户的余额,下面通过ATM机程序实现存款,取款等功能。
-         *
-         * =========ATM========
-         *    1、存款
-         *    2、取款
-         *    3、显示余额
-         *    4、退出
-         * 请选择(1-4):
-         *
-         * 取款 不能小于0
-         */
-
-        double balance = 0.0;
-        Scanner scanner = new Scanner(System.in);
-        boolean isFlag = true;
-        System.out.println("请选择输入类型!!!");
-        int type = scanner.nextInt();
-        while (isFlag){
-            switch (type){
-                case 1://存款
-                    double saveMoney = scanner.nextDouble();
-                    if(saveMoney > 0){
-                        balance += saveMoney;
-                        System.out.println("当前余额 = "+balance);
-                        isFlag = false;
-                    }else {
-                        System.out.println("存款金额需要 > 0");
-                    }
-                    break;
-                case 2://取款
-                    double getMoney = scanner.nextDouble();
-                    if(getMoney > 0){
-                        if(getMoney <= balance){
-                            balance -= getMoney;
-                            System.out.println("当前余额 = "+balance);
-                            isFlag = false;
-                        }else {
-                            System.out.println("余额不足!!");
-                            break;
-                        }
-                    }else {
-                        System.out.println("取款金额需要 > 0");
-                    }
-                    break;
-                case 3://显示余额
-                    System.out.println("当前余额为 = "+balance);
-                    isFlag = false;
-                    break;
-                case 4://退出
-                    isFlag = false;
-                    break;
-                default:
-                    System.out.println("输入有误 1-4选择,请重新输入");
-                    break;
-            }
-        }
-        scanner.close();
-    }
-}

+ 0 - 55
src/main/java/com/sf/sx/day03/Te.java

@@ -1,55 +0,0 @@
-package com.sf.sx.day03;
-
-import org.junit.Test;
-
-import static java.lang.Math.random;
-
-public class Te {
-    @Test
-    public void t1(){
-      //  数组统计:求总和、均值
-        int[] arr = {2,34,6,7,8,3,32,9};
-        //sum
-        int sum = 1;
-        for (int i  = 0;i< arr.length;i++){
-           sum *= arr[i];
-        }
-        System.out.println(sum);
-        //平均值
-        double avg =sum * 1.0/arr.length;
-        System.out.println(avg);
-    }
-
-    @Test
-    public void t2(){
-    //  求数组的最大值
-        int[] arr = {2,34,6,7,8,3,32,9};
-        //  假设一个最大值
-        int max = arr[0];
-        for (int i = 1 ;i<arr.length;i++){
-            if(arr[i] > max){
-                max = arr[i];
-            }
-        }
-        System.out.println(max);
-    }
-
-    @Test
-    public void t3(){
-    //   随机生成验证码   6位   数组和字符
-        char[] chars = new char[26*2+10];
-        for (int i= 0;i<26;i++){
-            chars[i] = (char) ('a'+i);
-            chars[26+i] = (char) ('A'+i);
-        }
-        for (int i = 0;i<10;i++){
-            chars[52+i] = (char) (i+'0');
-        }
-        String str = "";
-        for (int i =0;i<6;i++){
-         int index = (int) (Math.random()*chars.length);
-          str += chars[index];
-        }
-        System.out.println(str);
-    }
-}

+ 0 - 28
src/main/java/com/sf/sx/day04/BSX.java

@@ -1,28 +0,0 @@
-package com.sf.sx.day04;
-
-public class BSX {
-
-    private Integer dw;
-
-    public BSX(Integer dw) {
-        this.dw = dw;
-    }
-
-    public BSX() {
-    }
-
-    public Integer getDw() {
-        return dw;
-    }
-
-    public void setDw(Integer dw) {
-        this.dw = dw;
-    }
-
-
-    public String getInfo() {
-        return "BSX{" +
-                "dw=" + dw +
-                '}';
-    }
-}

+ 0 - 122
src/main/java/com/sf/sx/day04/Car.java

@@ -1,122 +0,0 @@
-package com.sf.sx.day04;
-
-import sun.util.resources.cldr.es.CalendarData_es_PY;
-
-public class Car {
-    /**
-
-
-     *
-     * ​	方法: printInfo  输出( 发动机类  变速箱类 地盘  )信息。
-     *
-     * - 发动机类
-     *
-     *
-     * ​	 属性: 基本 马力  排量 (普通属性)s
-     *
-     * ​	 方法: getinfo返回基本信息
-     *
-     * - 变速箱类
-     *
-     *
-     * ​	属性: 挡位数量
-     *
-     * ​	方法: getinfo返回基本信息
-     *
-     * - 地盘 类
-     *
-     *
-     * ​	属性 : 悬挂类型
-     *
-     * ​	方法:  getinfo返回基本信息
-     */
-
-    private String name;
-
-    private FDJ fdj;
-
-    private BSX bsx;
-
-    private DP dp;
-
-    public Car(String name, FDJ fdj, BSX bsx, DP dp) {
-        this.name = name;
-        this.fdj = fdj;
-        this.bsx = bsx;
-        this.dp = dp;
-    }
-
-    public Car() {
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public FDJ getFdj() {
-        return fdj;
-    }
-
-    public void setFdj(FDJ fdj) {
-        this.fdj = fdj;
-    }
-
-    public BSX getBsx() {
-        return bsx;
-    }
-
-    public void setBsx(BSX bsx) {
-        this.bsx = bsx;
-    }
-
-    public DP getDp() {
-        return dp;
-    }
-
-    public void setDp(DP dp) {
-        this.dp = dp;
-    }
-
-    @Override
-    public String toString() {
-        return "Car{" +
-                "name='" + name + '\'' +
-                ", fdj=" + fdj +
-                ", bsx=" + bsx +
-                ", dp=" + dp +
-                '}';
-    }
-
-
-
-    public String printInfo(String name,FDJ fdj,BSX bsx,DP dp){
-        return "Car{" +
-                "name='" + name + '\'' +
-                ", fdj=" + fdj.getInfo() +
-                ", bsx=" + bsx.getInfo() +
-                ", dp=" + dp.getInfo() +
-                '}';
-
-    }
-
-
-    public static void main(String[] args) {
-        Car car = new Car();
-        car.setName("奥迪");
-        //  对汽车类的属性进行赋值
-        FDJ fdj1 = new FDJ();
-        fdj1.setMl(123);
-        fdj1.setPl(20.0);
-        car.setFdj(fdj1);
-        BSX bsx1 = new BSX(7);
-        car.setBsx(bsx1);
-        DP dp1 = new DP(3);
-        car.setDp(dp1);
-        String s = car.printInfo(car.getName(), fdj1, bsx1, dp1);
-        System.out.println(s);
-    }
-}

+ 0 - 27
src/main/java/com/sf/sx/day04/DP.java

@@ -1,27 +0,0 @@
-package com.sf.sx.day04;
-
-public class DP {
-    private Integer xglx;
-
-    public DP() {
-    }
-
-    public DP(Integer xglx) {
-        this.xglx = xglx;
-    }
-
-    public Integer getXglx() {
-        return xglx;
-    }
-
-    public void setXglx(Integer xglx) {
-        this.xglx = xglx;
-    }
-
-
-    public String getInfo() {
-        return "DP{" +
-                "xglx=" + xglx +
-                '}';
-    }
-}

+ 0 - 41
src/main/java/com/sf/sx/day04/FDJ.java

@@ -1,41 +0,0 @@
-package com.sf.sx.day04;
-
-public class FDJ {
-    private  Integer ml;
-
-    private  double pl;
-
-    public FDJ() {
-    }
-
-    public FDJ(Integer ml, double pl) {
-        this.ml = ml;
-        this.pl = pl;
-    }
-
-    public Integer getMl() {
-        return ml;
-    }
-
-    public void setMl(Integer ml) {
-        this.ml = ml;
-    }
-
-    public double getPl() {
-        return pl;
-    }
-
-    public void setPl(double pl) {
-        this.pl = pl;
-    }
-
-
-    public String getInfo() {
-        return "FDJ{" +
-                "ml=" + ml +
-                ", pl=" + pl +
-                '}';
-    }
-
-
-}

+ 0 - 65
src/main/java/com/sf/sx/day04/Person.java

@@ -1,65 +0,0 @@
-package com.sf.sx.day04;
-
-public class Person implements Comparable{
-    private String name;
-    private int age;
-
-    public Person() {
-    }
-
-    public Person(String name, int age) {
-        this.name = name;
-        this.age = age;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public int getAge() {
-        return age;
-    }
-
-    public void setAge(int age) {
-        this.age = age;
-    }
-
-    @Override
-    public String toString() {
-        return "Person{" +
-                "name='" + name + '\'' +
-                ", age=" + age +
-                '}';
-    }
-
-    public String getInfo() {
-        return "Person{" +
-                "name='" + name + '\'' +
-                ", age=" + age +
-                '}';
-    }
-
-
-    public void study(){
-        System.out.println("studying");
-    }
-
-
-    @Override
-    public int compareTo(Object o) {
-        if(o instanceof  Person){
-            Person person = (Person) o;
-            return this.age = ((Person) o).age;
-        }else {
-            Person person = (Person) o;
-            return Integer.parseInt (this.name = person.name);
-        }
-
-
-
-    }
-}

+ 0 - 12
src/main/java/com/sf/sx/day04/PersonUtils.java

@@ -1,12 +0,0 @@
-package com.sf.sx.day04;
-
-public class PersonUtils {
-    public boolean compare(Person person1,Person person2){
-        if((person1.getName().equals(person2.getName()) && (person1.getAge() == person2.getAge()))){
-            return true;
-        }else {
-            return false;
-        }
-
-    }
-}

+ 0 - 79
src/main/java/com/sf/sx/day04/Student.java

@@ -1,79 +0,0 @@
-package com.sf.sx.day04;
-
-/**
- * 学生类
- */
-public class Student {
-    //  属性
-    private String sno;
-    private String sName;
-    private Integer age;
-    private  Double height;
-
-    public Student() {
-    }
-
-    public Student(String sno, String sName, Integer age, Double height) {
-        this.sno = sno;
-        this.sName = sName;
-        this.age = age;
-        this.height = height;
-    }
-
-    public String getSno() {
-        return sno;
-    }
-
-    public void setSno(String sno) {
-        this.sno = sno;
-    }
-
-    public String getsName() {
-        return sName;
-    }
-
-    public void setsName(String sName) {
-        this.sName = sName;
-    }
-
-    public Integer getAge() {
-        return age;
-    }
-
-    public void setAge(Integer age) {
-        this.age = age;
-    }
-
-    public Double getHeight() {
-        return height;
-    }
-
-    public void setHeight(Double height) {
-        this.height = height;
-    }
-
-    @Override
-    public String toString() {
-        return "Student{" +
-                "sno='" + sno + '\'' +
-                ", sName='" + sName + '\'' +
-                ", age=" + age +
-                ", height=" + height +
-                '}';
-    }
-
-    /**
-     * 学习方法
-     * @param sName
-     */
-    public void study(String sName){
-        System.out.println(sName+" 正在学习~");
-    }
-
-    /**
-     * 吃饭
-     */
-    public void eat(){
-        System.out.println("学生正在吃饭~");
-    }
-}

+ 0 - 84
src/main/java/com/sf/sx/day04/TE.java

@@ -1,84 +0,0 @@
-package com.sf.sx.day04;
-
-import org.junit.Test;
-
-public class TE {
-    @Test
-    public void t1(){
-
-        /**
-         *  学生类-练习
-         *
-         * * 需求:首先定义一个学生类 抽取一些属性(4个属性)方法(2个方法)
-         *
-         *   然后定义一个学生测试类,在学生测试类中通过对象完成成员变量和成员方法的使用
-         *
-         * * 分析:
-         *
-         *   * 成员变量:姓名,年龄   …
-         *   * 成员方法:学习,做作业   …
-         */
-        // 1  创建实例对象
-        Student student = new Student();
-        student.setSno("123456789");
-        student.setsName("lisa");
-        student.setAge(22);
-        student.setHeight(183.1);
-        // 打印当前对象
-        System.out.println(student);
-        student.study(student.getsName());
-        student.eat();
-    }
-
-    /**
-     * **练习1:**创建一个Person类,其定义如下:
-     *
-     * ```java
-     * Person
-     * 属性
-     *   name:String
-     *   age:int
-     * 方法
-     *   +study():void
-     *   +setName(String n):void
-     *   +getName():String
-     *   +setAge(int a):void
-     *   +getAge():int
-     *   +getInfo():void
-     * ```
-     *
-     * 要求:
-     *
-     * - 创建Person类的对象,设置该对象的name、age属性,
-     *   - 调用study方法,输出字符串“studying”,
-     *   - 调用set方法设置属性,调用get方法获取值,
-     *   - 调用getInfo输出person对象内容成员属性。
-     * - 创建测试类,创建两个人分别调用上面方法。
-     *
-     * - 创建PersonUtils工具类,声明比较方法,通过姓名年龄比较, 如果姓名年龄一致返回true否则返回false。
-     */
-
-    @Test
-    public void t6(){
-        /**
-         * **练习2:** Person中添加phone属性
-         *
-         * - 定义一个Phone类,cpu核心数,ram内存,rom存储,一个getInfo()方法返回phone的信息。
-         *
-         *
-         * - 在类中定义一个方法printInfo(),该方法的定义如下:
-         *   - public void printInfo(Phone p),在printInfo方法中调用getInfo方法输出手机的信息。
-         *
-         * - 在测试类中,创建Person和Phone 测试。
-         */
-    }
-
-    @Test
-    public void t2(){
-        /**
-         *
-         * - 小猫:属性(姓名,id),方法(抓老鼠, 吃,睡,自我介绍)
-         * - 老鼠:属性(姓名,id),方法(打洞, 吃,睡,自我介绍)
-         */
-    }
-}

+ 0 - 50
src/main/java/com/sf/sx/day04/l2/Mouse.java

@@ -1,50 +0,0 @@
-package com.sf.sx.day04.l2;
-
-public class Mouse {
-    private  String name;
-    private Integer id;
-
-    public Mouse() {
-    }
-
-    public Mouse(String name, Integer id) {
-        this.name = name;
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    @Override
-    public String toString() {
-        return "Cat{" +
-                "name='" + name + '\'' +
-                ", id=" + id +
-                '}';
-    }
-
-    public void eat(String name){
-        System.out.println(name+"eat~");
-    }
-
-    public void sleep(String name){
-        System.out.println(name+"sleep~");
-    }
-
-    public void play(String name){
-        System.out.println(name+"play~");
-    }
-}

+ 0 - 71
src/main/java/com/sf/sx/day04/l2/Phone.java

@@ -1,71 +0,0 @@
-package com.sf.sx.day04.l2;
-
-public class Phone {
-    // cpu核心数,ram内存,rom存储,一个getInfo()方法返回phone的信息。
-    private int cpu;
-    private String ram;
-    private String rom;
-
-    public Phone() {
-    }
-
-    public Phone(int cpu, String ram, String rom) {
-        this.cpu = cpu;
-        this.ram = ram;
-        this.rom = rom;
-    }
-
-    public int getCpu() {
-        return cpu;
-    }
-
-    public void setCpu(int cpu) {
-        this.cpu = cpu;
-    }
-
-    public String getRam() {
-        return ram;
-    }
-
-    public void setRam(String ram) {
-        this.ram = ram;
-    }
-
-    public String getRom() {
-        return rom;
-    }
-
-    public void setRom(String rom) {
-        this.rom = rom;
-    }
-
-    @Override
-    public String toString() {
-        return "Phone{" +
-                "cpu=" + cpu +
-                ", ram='" + ram + '\'' +
-                ", rom='" + rom + '\'' +
-                '}';
-    }
-
-    public String getInfo() {
-        return "Phone{" +
-                "cpu=" + cpu +
-                ", ram='" + ram + '\'' +
-                ", rom='" + rom + '\'' +
-                '}';
-    }
-
-
-
-
-    public static void main(String[] args) {
-        Person person = new Person();
-        Phone phone = new Phone();
-        phone.setCpu(1);
-        phone.setRom("123");
-        phone.setRam("1233");
-        person.setPhone(phone);
-        person.printInfo(phone);
-    }
-}

+ 0 - 22
src/main/java/com/sf/sx/day04/l2/extend/Cat.java

@@ -1,22 +0,0 @@
-package com.sf.sx.day04.l2.extend;
-
-
-public class Cat extends Animal{
-
-    @Override
-    public void eat(String name) {
-        System.out.println(name+"eat");
-    }
-
-    public void catMouse(){
-        System.out.println("小猫捉老鼠");
-    }
-    public static void main(String[] args) {
-        Cat cat = new Cat();
-        cat.setName("小猫");
-        cat.setId(111);
-        System.out.println(cat);
-        cat.catMouse();
-        cat.eat(cat.getName());
-    }
-}

+ 0 - 22
src/main/java/com/sf/sx/day04/l2/extend/Mouse.java

@@ -1,22 +0,0 @@
-package com.sf.sx.day04.l2.extend;
-
-public class Mouse extends Animal{
-    @Override
-    public void eat(String name) {
-        System.out.println(name+"eat");
-    }
-
-    public void play(){
-        System.out.println("老鼠打洞");
-    }
-
-    public static void main(String[] args) {
-        Mouse mouse = new Mouse();
-        mouse.setId(22);
-        mouse.setName("老鼠");
-        mouse.eat(mouse.getName());
-        mouse.play();
-    }
-
-}
-

+ 0 - 16
src/main/java/com/sf/sx/day05/Te.java

@@ -1,16 +0,0 @@
-package com.sf.sx.day05;
-
-import org.junit.Test;
-
-public class Te {
-    @Test
-    public void t1(){
-        /**
-         * 小明的父亲有一辆20年的小汽车:汽车中有 启动  行驶的方法。
-         *
-         * 小明买了又买了一辆智能汽车,汽车中也有 启动 行驶 的方法。
-         *
-         * 这是对于父类的启动行驶的方法,在智能汽车中重写这两个方法就可以了,因为需求不同。
-         */
-    }
-}

+ 0 - 8
src/main/java/com/sf/sx/day05/lx/Animal.java

@@ -1,8 +0,0 @@
-package com.sf.sx.day05.lx;
-//  函数式接口
-@FunctionalInterface
-public interface Animal {
-
-    //  抽象方法
-    void  run();
-}

+ 0 - 13
src/main/java/com/sf/sx/day05/lx/Car.java

@@ -1,13 +0,0 @@
-package com.sf.sx.day05.lx;
-
-public abstract class Car {
-
-    public void start() {
-
-    }
-
-
-    public void drive(){
-        System.out.println("汽车、行驶");
-    }
-}

+ 0 - 14
src/main/java/com/sf/sx/day05/lx/NewCar.java

@@ -1,14 +0,0 @@
-package com.sf.sx.day05.lx;
-
-public class NewCar extends  Car{
-    @Override
-    public void start() {
-        System.out.println("智能汽车启动");
-    }
-
-
-    @Override
-    public void drive() {
-        System.out.println("智能汽车行驶");
-    }
-}

+ 0 - 15
src/main/java/com/sf/sx/day05/lx/OldCar.java

@@ -1,15 +0,0 @@
-package com.sf.sx.day05.lx;
-
-public class OldCar extends Car{
-
-    @Override
-    public void start() {
-        System.out.println("老式汽车启动");
-    }
-
-
-    @Override
-    public void drive() {
-        System.out.println("老式汽车行驶");
-    }
-}

+ 0 - 10
src/main/java/com/sf/sx/day05/lx/impl/AnimalImpl.java

@@ -1,10 +0,0 @@
-package com.sf.sx.day05.lx.impl;
-
-import com.sf.sx.day05.lx.Animal;
-
-public class AnimalImpl implements Animal {
-    @Override
-    public void run() {
-        System.out.println("实现类进行接口中的抽象方法实现");
-    }
-}

+ 0 - 57
src/main/java/com/sf/sx/day06/TE.java

@@ -1,57 +0,0 @@
-package com.sf.sx.day06;
-
-import org.junit.Test;
-
-import java.util.*;
-
-public class TE {
-    @Test
-    public void t1(){
-        List<String> list = new ArrayList();
-        List<String> list2 = new ArrayList();
-        list.add("aa");
-        list.add("aa1");
-        list.add("bb");
-//        for (String s : list) {
-//            System.out.println(s);
-//        }
-
-        list2.add("aa");
-        list2.add("bb");
-        list.addAll(list2);
-        System.out.println(list);
-        for (int i = 0; i <list.size(); i++) {
-            if(list.get(i).contains("aa")){
-                list.remove(i);
-                i--;
-            }
-        }
-        System.out.println(list);
-
-        //  采用迭代器进行删除
-        Iterator<String> iterator = list.iterator();
-        while (iterator.hasNext()){
-            if(iterator.next().contains("aa")){
-                iterator.remove();
-            }
-        }
-        System.out.println(list);
-    }
-
-
-    @Test
-    public void t2(){
-        Set<String> set = new HashSet<>();
-        set.add("aof");
-        set.add("qqq");
-        set.add("qqq");
-        System.out.println(set);
-        Map<String,String> map = new HashMap();
-        map.put("name","admin");
-        map.put("userName","admin1");
-        System.out.println(map);
-        String s = map.get("name");
-        System.out.println(s);
-
-    }
-}

+ 0 - 60
src/main/java/com/sf/sx/day07/Data.java

@@ -1,60 +0,0 @@
-package com.sf.sx.day07;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Data {
-    // 创建一个集合 用于承装数据
-    public static List<Product> products = new ArrayList<>();
-    static {
-        products.add(new Product(1L, "苹果手机", 8888.88,"手机"));
-        products.add(new Product(2L, "华为手机", 6666.66,"手机"));
-        products.add(new Product(3L, "联想笔记本",7777.77,"电脑"));
-        products.add(new Product(4L, "机械键盘", 999.99,"键盘"));
-        products.add(new Product(5L, "雷蛇鼠标", 222.22,"鼠标"));
-    }
-
-
-    public static void main(String[] args) {
-        //   帅选出商品名字包含手机的商品
-        List<Product> productByName = findProductByName(Data.products);
-        System.out.println(productByName);
-        List<Product> productByPrice = findProductByPrice(Data.products);
-        System.out.println(productByPrice);
-
-    }
-    /**
-     * 筛选出商品名字包含手机的商品
-     * @param products
-     * @return
-     */
-    public static List<Product> findProductByName(List<Product> products){
-        List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(product.getName().contains("手机")){
-                list.add(product);
-            }
-        }
-        return  list;
-    }
-
-    /**
-     * 价格大于1000
-     * @param products
-     * @return
-     */
-    public static List<Product> findProductByPrice(List<Product> products){
-        List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(product.getPrice()>1000){
-                list.add(product);
-            }
-        }
-        return  list;
-    }
-
-
-
-}

+ 0 - 5
src/main/java/com/sf/sx/day07/MyPredicate.java

@@ -1,5 +0,0 @@
-package com.sf.sx.day07;
-
-public interface MyPredicate {
-    boolean test(Product product);
-}

+ 0 - 60
src/main/java/com/sf/sx/day07/Product.java

@@ -1,60 +0,0 @@
-package com.sf.sx.day07;
-
-public class Product {
-    private Long id;
-    private String name;
-    private double price;
-    private String type;
-
-    public Product() {
-    }
-
-    public Product(Long id, String name, double price, String type) {
-        this.id = id;
-        this.name = name;
-        this.price = price;
-        this.type = type;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public double getPrice() {
-        return price;
-    }
-
-    public void setPrice(double price) {
-        this.price = price;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    @Override
-    public String toString() {
-        return "Product{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                ", price=" + price +
-                ", type='" + type + '\'' +
-                '}';
-    }
-}

+ 0 - 83
src/main/java/com/sf/sx/day07/Te.java

@@ -1,83 +0,0 @@
-package com.sf.sx.day07;
-
-import org.junit.Test;
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class Te {
-    @Test
-    public void t1(){
-        int[] arr = {1,2,3,4,3,2,1};
-        for (int left = 0,right = arr.length-1;left<right;left++,right--){
-            if(arr[left] != arr[right]){
-                break;
-            }
-        }
-    }
-
-    @Test
-    public void t2(){
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                System.out.println("线程启动");
-            }
-        }).start();
-
-        //  用新特性lambda进行编写
-        new Thread(() -> System.out.println("线程启动")).start();
-    }
-
-    /**
-     *   匿名内部类   筛选出所有名称包含手机的商品
-     */
-    @Test
-    public void t3(){
-        List<Product> productList = findProductByCondition(Data.products, new MyPredicate() {
-            @Override
-            public boolean test(Product product) {
-                return product.getName().contains("手机");
-            }
-        });
-        System.out.println(productList);
-
-
-        List<Product> productListByPrice = findProductByCondition(Data.products, new MyPredicate() {
-            @Override
-            public boolean test(Product product) {
-                return product.getPrice()>1000;
-            }
-        });
-        System.out.println(productListByPrice);
-    }
-
-
-    public static List<Product> findProductByCondition(List<Product> products,MyPredicate myPredicate){
-          List<Product> list = new ArrayList<>();
-        for (Product product : products) {
-            if(myPredicate.test(product)){
-                list.add(product);
-            }
-        }
-        return list;
-
-    }
-
-    /**
-     * 采用lambda表达式的方式
-     */
-    @Test
-    public void t6(){
-        //需求1: 筛选出所有名称包含手机的商品
-        List<Product> productListByName = findProductByCondition(Data.products,
-                (product) -> product.getName().contains("手机"));
-        System.out.println(productListByName);
-
-        // 需求2: 筛选出所有价格大于1000的商品
-        List<Product> productListByPrice = findProductByCondition(Data.products,
-                (product) -> product.getPrice()>1000);
-        System.out.println(productListByPrice);
-    }
-
-}

+ 20 - 6
src/main/java/com/sf/sx/day04/l2/Person.java → src/main/java/com/sf/sx2/Person.java

@@ -1,15 +1,18 @@
-package com.sf.sx.day04.l2;
+package com.sf.sx2;
 
 public class Person {
-    private Phone phone;
 
-    public Person() {
-    }
+
+    private Phone phone;
 
     public Person(Phone phone) {
         this.phone = phone;
     }
 
+    public Person() {
+
+    }
+
     public Phone getPhone() {
         return phone;
     }
@@ -25,7 +28,18 @@ public class Person {
                 '}';
     }
 
-    public void printInfo(Phone phone) {
-        System.out.println(phone.getInfo());
+
+    public void printInfo(Phone phone){
+        System.out.println(phone);
+    }
+
+    public static void main(String[] args) {
+        Person person = new Person();
+        Phone phone1 = new Phone();
+        phone1.setCpu(1);
+        phone1.setRom(2);
+        phone1.setRam(3);
+        person.setPhone(phone1);
+        System.out.println(person);
     }
 }

+ 65 - 0
src/main/java/com/sf/sx2/Person1.java

@@ -0,0 +1,65 @@
+package com.sf.sx2;
+
+public class Person1 {
+
+    private int age;
+    private String name;
+
+    public Person1() {
+    }
+
+    public Person1(int age, String name) {
+        this.age = age;
+        this.name = name;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+//    @Override
+    public String getInfo() {
+        return "Person1{" +
+                "age=" + age +
+                ", name='" + name + '\'' +
+                '}';
+    }
+
+
+    public void study(){
+        System.out.println("studying");
+    }
+
+
+    public static void main(String[] args) {
+        Person1 person1 = new Person1();
+        person1.setAge(19);
+        person1.setName("ls");
+        person1.study();
+//        String info = person1.getInfo();
+//        System.out.println(info);
+        Person1 person2 = new Person1();
+        person2.setAge(191);
+        person2.setName("ls");
+        person2.study();
+//        String info = person1.getInfo();
+//        System.out.println(info);
+
+        boolean compare = PersonUtils.compare(person1, person2);
+        System.out.println(compare);
+
+    }
+
+}

+ 11 - 0
src/main/java/com/sf/sx2/PersonUtils.java

@@ -0,0 +1,11 @@
+package com.sf.sx2;
+
+public class PersonUtils {
+
+    public static boolean compare(Person1 person1,Person1 person2) {
+    if(person1.getName().equals(person2.getName())  && person1.getAge() == person2.getAge()){
+        return true;
+    }else
+       return false;
+    }
+}

+ 50 - 0
src/main/java/com/sf/sx2/Phone.java

@@ -0,0 +1,50 @@
+package com.sf.sx2;
+
+public class Phone {
+
+
+    private int ram;
+    private int rom;
+    private int cpu;
+    public Phone(int ram, int rom, int cpu) {
+        this.ram = ram;
+        this.rom = rom;
+        this.cpu = cpu;
+    }
+
+    public Phone() {
+    }
+
+    public int getRam() {
+        return ram;
+    }
+
+    public void setRam(int ram) {
+        this.ram = ram;
+    }
+
+    public int getRom() {
+        return rom;
+    }
+
+    public void setRom(int rom) {
+        this.rom = rom;
+    }
+
+    public int getCpu() {
+        return cpu;
+    }
+
+    public void setCpu(int cpu) {
+        this.cpu = cpu;
+    }
+
+    @Override
+    public String toString() {
+        return "Phone{" +
+                "ram=" + ram +
+                ", rom=" + rom +
+                ", cpu=" + cpu +
+                '}';
+    }
+}

+ 97 - 0
src/main/java/com/sf/sx2/Student.java

@@ -0,0 +1,97 @@
+package com.sf.sx2;
+
+public class Student {
+    //  4个属性
+    /**
+     * private    权限修饰符中的一种
+     * 只能够在当前类中进行使用
+     * name  赋值
+     * public 方法
+     *
+     *
+     *类中三件套:
+     * 构造器
+     * getterSetter方法
+     * toString();
+     */
+    private String name;
+    private int age;
+    private double height;
+    private double  weight;
+
+    /**
+     * 构造器的作用:
+     * 1、属性的赋值
+     * 2、对象的创建
+     * 当前类中包含有参构造器,系统不会产生无参构造器,否则会自动生成无参构造器
+     */
+    public Student(){
+
+    }
+    public Student(String name,int age,double height,double weight){
+        this.name = name;
+        this.age = age;
+        this.height = height;
+        this.weight = weight;
+    }
+    public void setName(String name){
+        this.name = name;
+    }
+    public String getName(){
+        return name;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public double getHeight() {
+        return height;
+    }
+
+    public void setHeight(double height) {
+        this.height = height;
+    }
+
+    public double getWeight() {
+        return weight;
+    }
+
+    public void setWeight(double weight) {
+        this.weight = weight;
+    }
+
+
+    @Override
+    public String toString() {
+        return "Student{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                ", height=" + height +
+                ", weight=" + weight +
+                '}';
+    }
+
+    public static void main(String[] args) {
+        Student student = new Student();
+        student.setAge(12);
+        System.out.println(student);
+    }
+
+
+    /**
+     * **练习2:** Person中添加phone属性
+     *
+     * - 定义一个Phone类,cpu核心数,ram内存,rom存储,一个getInfo()方法返回phone的信息。
+     *
+     *
+     * - 在类中定义一个方法printInfo(),该方法的定义如下:
+     *   - public void printInfo(Phone p),在printInfo方法中调用getInfo方法输出手机的信息。
+     *
+     * - 在测试类中,创建Person和Phone 测试。
+     */
+}

+ 274 - 0
src/main/java/com/sf/sx2/Te2.java

@@ -2,6 +2,7 @@ package com.sf.sx2;
 
 import org.junit.Test;
 
+import java.util.Arrays;
 import java.util.Scanner;
 
 public class Te2 {
@@ -263,6 +264,279 @@ public class Te2 {
         System.out.println(sum);
     }
 
+    /**
+     * 数组
+     * 一维数组
+     * 作业1:重写数组中的toString();方法   // [1, 2, 3, 6]
+     *
+     * 作业2:  找最值及其第一次出现的下标
+     *
+     *
+     * **举例1:**数组统计:求总和、均值
+     *
+     * **举例2:**求数组元素的总乘积
+     *
+     * **举例3:**求数组元素的最大值
+     *
+     * 第一季度 每一个月的销售额 分别是 12,14,24,
+     * 第二季度 每一个月的销售额 分别是 23,18,35,
+     * 第二季度 每一个月的销售额 分别是 33,48,25,
+     * 第二季度 每一个月的销售额 分别是 27,28,35,
+     * 二维数组实现
+     *求出 每个月的平均销售额,和总销售额
+     */
+
+    /**
+     * 数组中常见简单算法
+     * 1、数组元素的反转
+     * 2、数组的复制
+     * 3、二分查找
+     * 4、冒泡排序
+     */
+
+    @Test
+    public void t14(){
+    // 二分查找   数组必须是有序的
+        int[] arr = new int[]{1,2,3,4,5,6};
+        int value = 15;
+        int head = 0;
+        boolean flag  = true;
+        int end = arr.length-1;
+        while (head<=end){
+            int mid = (head + end) / 2;
+            if(arr[mid] == value){
+                System.out.println(mid);
+                flag = false;
+                break;
+            }else if (arr[mid] > value){
+                end = mid -1;
+            }else {
+                head = mid +1;
+            }
+        }
+        if(flag){
+            System.out.println("没找到");
+
+        }
+    }
+
+    @Test
+    public void t13(){
+    //数组的复制
+        int[] arr = new int[]{1,2,3,4,5,6};
+        int[] arr1 = new int[arr.length];
+        for (int i= 0;i<arr.length;i++){
+            arr1[i] = arr[i];
+        }
+        System.out.println(Arrays.toString(arr1));
+    }
+    @Test
+    public void t12(){
+    //  数组元素的反转
+        int[] arr = new int[]{1,2,3,4,5,6};
+        for (int left =0,right = arr.length-1;left<right;left++,right-- ){
+            int temp = arr[left];
+            arr[left] = arr[right];
+            arr[right] = temp;
+        }
+        System.out.println(Arrays.toString(arr));
+    }
+    @Test
+    public void t8(){
+    //定义方式
+        int[] arr = {1,2,3,6};
+        System.out.println(arr.toString());//  c语言arr[0]   错误的
+        // [1, 2, 3, 6]
+        System.out.println(Arrays.toString(arr));
+
+        System.out.println(arr[2]);
+
+        int arr1[] = {1,2,3,6};
+        for (int i = 0;i<arr1.length;i++){
+            System.out.println(arr1[i]);
+        }
+        int[] arr2 = new int[]{};
+        int[] arr3 = new int[5];
+        int[] arr6 = new int[5];
+        /**
+         * 两个相同数组中的引用
+         * ”引用”指的是地址吗
+         *
+         */
+        int[] arr4;
+        arr4 = new int[7];
+    }
+
+    /**
+     * 求数组元素的最大值
+     */
+    @Test
+    public void t9(){
+    int[] arr = new int[]{2,3,46,8,9,2,6543,2,3456,78,7654,3};
+    //寻找最大值   假设第一个元素就是最大值
+        int max = arr[0];
+        for (int i= 1;i<arr.length;i++){
+            if(arr[i] > max){
+                max = arr[i];
+            }
+        }
+        System.out.println(max);
+    }
+
+    /**
+     * 当前二维数组
+     * 数组的数组
+     * [一维数组 ,  一维数组 ,  一维数组]
+     */
+    @Test
+    public void t10(){
+    int[][] arr = {{1,23,4},{2,3,4},{1,1,1}};
+    //  获取   23数据   arr[0][1]     arr[1][2]
+        System.out.println(arr);
+        System.out.println(arr[1]);
+        // 遍历arr数组
+        for (int i = 0;i<arr.length;i++){
+            for (int j = 0;j<arr[i].length;j++){
+                System.out.println(arr[i][j]);
+            }
+        }
+
+    int[][] arr1 = new int[][]{};
+
+        /**
+         * 2:二维数组的长度
+         * 3:二维数组中元素(一维数组)的长度
+         */
+    int[][] arr2 = new int[2][3];
+    }
 
 
+    @Test
+    public void t11(){
+        /**
+         * 第一季度 每一个月的销售额 分别是 12,14,24,
+         * 第二季度 每一个月的销售额 分别是 23,18,35,
+         * 第二季度 每一个月的销售额 分别是 33,48,25,
+         * 第二季度 每一个月的销售额 分别是 27,28,35,
+         * 二维数组实现
+         * 求出 每个月的平均销售额,和总销售额
+         */
+        int[][] arr = {{12,14,24},{23,18,35},{33,48,25},{27,28,35} };
+        int sum = 0;
+        int count = 0;
+        for (int i = 0;i<arr.length;i++){
+            for (int j = 0;j<arr[i].length;j++){
+                sum +=arr[i][j];
+                count++;
+            }
+        }
+        System.out.println(sum);
+        System.out.println(sum*1.0/count);
+    }
+
+    /**
+     * 冒泡排序
+     */
+    @Test
+    public void t15(){
+        int[] arr = new int[]{2,34,25,8,3,5,3};
+        for (int i = 1;i<arr.length;i++){
+            for (int j = 0;j<arr.length-i;j++){
+                if(arr[j] >arr[j+1]){
+                    //交换
+                    int temp = arr[j];
+                    arr[j] = arr[j+1];
+                    arr[j+1] = temp;
+                }
+            }
+        }
+        System.out.println(Arrays.toString(arr));
+    }
+
+    /**
+     * 4、随机生成一组验证码
+     * 10、找出出现奇数次的数
+     * 3、统计字符出现次数
+     */
+    @Test
+    public void t16(){
+        /**
+         * 随机生成一组验证码,验证码由大小写字母和10个阿拉伯数字字符中的任意6位组成。
+         */
+        char[] chars = new char[62];
+        //  数字  大写  小写
+        for (int i = 0;i<26;i++){
+            chars[i] = (char) ('a'+i);
+            chars[26+i] = (char) ('A'+i);
+        }
+        for (int i = 0;i<10;i++){
+            chars[52+i] = (char)('0'+i) ;
+        }
+
+//        System.out.println(Arrays.toString(chars));
+        String code  = "";
+        for (int i = 0;i<6;i++){
+            int index = (int) (Math.random()* chars.length);
+            code +=  chars[index];
+        }
+        System.out.println(code);
+    }
+
+    @Test
+    public void t17(){
+        // 10、找出出现奇数次的数
+        /**
+         * 开发提示:
+         * 因为对于任意一个数k,有k ^ k = 0,k ^ 0 = k,所以将arr中所有元素进行异或,那么个数为偶数的元素异或后都变
+         * 成了0,只留下了个数为奇数的那个元素。
+         */
+        int[] arr = {1,1,1,1,2,2,2,3,3,3,3};
+        int num = arr[0];
+        for (int i = 1;i<arr.length;i++){
+            num ^= arr[i];
+        }
+        System.out.println(num);
+    }
+
+
+    @Test
+    public void t18(){
+        /**
+         * 3、统计字符出现次数
+         * 英语中最长的单词是"pneumonoultramicroscopicsilicovolcanoconiosis",意思是“肺尘病,矽肺病”,
+         * 一共有45个英文
+         * 字母。现在要求统计这个单词中出现了哪些字母,以及它们出现的次数,并且找出出现次数最多的字母。
+         * 开发提示:
+         * (1)使用String类型的变量words存储英语单词
+         * "pneumonoultramicroscopicsilicovolcanoconiosis"
+         * (2)通过word.toCharArray()可以根据字符串word得到一个char[]类型的数组
+         * 其中toCharArray()是String类型提供的系统函数,就像Math.random()等函数一样,
+         * 后面会学到,这里先提前用一
+         * 下。它的作用就是创建一个char[]数组,并把字符串中的每一个字符依次存储到这个char[]数组中
+         */
+        char[] chars = "pneumonoultramicroscopicsilicovolcanoconiosis".toCharArray();
+        int[] arr = new  int[26];
+        for (int i= 0;i< chars.length;i++){
+            arr[chars[i]-97]++;
+        }
+        //  假设一个最大值
+        int max = arr[0];
+        for (int i= 0;i<arr.length;i++){
+            if (arr[i] > max) {
+                max = arr[i];
+            }
+        }
+        // 输出字符和次数
+        for (int i = 0;i<arr.length;i++){
+            if(arr[i] != 0){
+                System.out.println("当前字符"+(char) (i+97)+"出现的次数"+arr[i]);
+            }
+        }
+        //出现字母次数最多  + 字符
+        for (int i= 0;i<arr.length;i++){
+            if(max == arr[i]){
+                System.out.println((char) (i+97));
+            }
+        }
+    }
 }

BIN
target/classes/com/sf/day03/T.class


BIN
target/classes/com/sf/day06/Cat.class


BIN
target/classes/com/sf/day06/Mouse.class


BIN
target/classes/com/sf/day06/Person.class


BIN
target/classes/com/sf/day06/PersonTest.class


BIN
target/classes/com/sf/day06/Student.class


BIN
target/classes/com/sf/day06/Te.class


BIN
target/classes/com/sf/day06/entend/Animal.class


BIN
target/classes/com/sf/day06/entend/Cat.class


BIN
target/classes/com/sf/day06/entend/CreditCard.class


BIN
target/classes/com/sf/day06/entend/DepositCard.class


BIN
target/classes/com/sf/day06/entend/Mouse.class


BIN
target/classes/com/sf/quanrizhi/T.class


BIN
target/classes/com/sf/quanrizhi/day01/Column.class


BIN
target/classes/com/sf/quanrizhi/day01/Data.class


BIN
target/classes/com/sf/quanrizhi/day01/MyPredicate.class


BIN
target/classes/com/sf/quanrizhi/day01/Product.class


BIN
target/classes/com/sf/quanrizhi/day01/Student.class


BIN
target/classes/com/sf/quanrizhi/day01/Student1.class


BIN
target/classes/com/sf/quanrizhi/day01/T$1.class


BIN
target/classes/com/sf/quanrizhi/day01/T$2.class


BIN
target/classes/com/sf/quanrizhi/day01/T$3.class


BIN
target/classes/com/sf/quanrizhi/day01/T.class


BIN
target/classes/com/sf/quanrizhi/day01/Table.class


BIN
target/classes/com/sf/quanrizhi/day01/User.class


BIN
target/classes/com/sf/quanrizhi/day02/Te$1.class


BIN
target/classes/com/sf/quanrizhi/day02/Te$2.class


BIN
target/classes/com/sf/quanrizhi/day02/Te.class


BIN
target/classes/com/sf/quanrizhi/day02/User.class


BIN
target/classes/com/sf/quanrizhi/day03/TE.class


BIN
target/classes/com/sf/sx/day01/Te.class


BIN
target/classes/com/sf/sx/day02/TE.class


BIN
target/classes/com/sf/sx/day03/Te.class


BIN
target/classes/com/sf/sx/day04/BSX.class


BIN
target/classes/com/sf/sx/day04/Car.class


BIN
target/classes/com/sf/sx/day04/DP.class


BIN
target/classes/com/sf/sx/day04/FDJ.class


BIN
target/classes/com/sf/sx/day04/Person.class


BIN
target/classes/com/sf/sx/day04/PersonUtils.class


BIN
target/classes/com/sf/sx/day04/Student.class


BIN
target/classes/com/sf/sx/day04/TE.class


BIN
target/classes/com/sf/sx/day04/l2/Cat.class


BIN
target/classes/com/sf/sx/day04/l2/Mouse.class


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است