guyanqing 6 maanden geleden
bovenliggende
commit
f68b5fa249
67 gewijzigde bestanden met toevoegingen van 556 en 912 verwijderingen
  1. 23 0
      src/main/java/com/sf/day07/City.java
  2. 14 0
      src/main/java/com/sf/day07/Country.java
  3. 39 0
      src/main/java/com/sf/day07/Person.java
  4. 44 0
      src/main/java/com/sf/day07/Student.java
  5. 26 0
      src/main/java/com/sf/day07/Te.java
  6. 28 0
      src/main/java/com/sf/day07/lx/Animal.java
  7. 33 0
      src/main/java/com/sf/day07/lx/BuildCarsInterface.java
  8. 7 0
      src/main/java/com/sf/day07/lx/BuildCarsInterface2.java
  9. 34 0
      src/main/java/com/sf/day07/lx/BuildCarsInterfaceImpl.java
  10. 9 0
      src/main/java/com/sf/day07/lx/Cat.java
  11. 8 0
      src/main/java/com/sf/day07/lx/Coco.java
  12. 24 0
      src/main/java/com/sf/day07/lx/Cook.java
  13. 15 0
      src/main/java/com/sf/day07/lx/Dog.java
  14. 9 0
      src/main/java/com/sf/day07/lx/Drink.java
  15. 18 0
      src/main/java/com/sf/day07/lx/Employee.java
  16. 17 0
      src/main/java/com/sf/day07/lx/Manager.java
  17. 31 0
      src/main/java/com/sf/day07/lx/SaltDrink.java
  18. 41 0
      src/main/java/com/sf/day07/lx/Student.java
  19. 12 0
      src/main/java/com/sf/day07/lx/T.java
  20. 31 0
      src/main/java/com/sf/day07/lx/Te.java
  21. 23 0
      src/main/java/com/sf/day07/lx/Te2.java
  22. 37 0
      src/main/java/com/sf/day07/lx/Test1.java
  23. 29 0
      src/main/java/com/sf/day07/lx/TestCodeDiv.java
  24. 4 0
      src/main/java/com/sf/day07/lx/rew.java
  25. 0 45
      src/main/java/com/sf/sx2/Person.java
  26. 0 65
      src/main/java/com/sf/sx2/Person1.java
  27. 0 11
      src/main/java/com/sf/sx2/PersonUtils.java
  28. 0 50
      src/main/java/com/sf/sx2/Phone.java
  29. 0 97
      src/main/java/com/sf/sx2/Student.java
  30. 0 102
      src/main/java/com/sf/sx2/Te.java
  31. 0 542
      src/main/java/com/sf/sx2/Te2.java
  32. BIN
      target/classes/com/sf/day07/City.class
  33. BIN
      target/classes/com/sf/day07/Country.class
  34. BIN
      target/classes/com/sf/day07/Person.class
  35. BIN
      target/classes/com/sf/day07/Student.class
  36. BIN
      target/classes/com/sf/day07/Te.class
  37. BIN
      target/classes/com/sf/day07/lx/A.class
  38. BIN
      target/classes/com/sf/day07/lx/Animal.class
  39. BIN
      target/classes/com/sf/day07/lx/B.class
  40. BIN
      target/classes/com/sf/day07/lx/BuildCarsInterface.class
  41. BIN
      target/classes/com/sf/day07/lx/BuildCarsInterfaceImpl.class
  42. BIN
      target/classes/com/sf/day07/lx/C.class
  43. BIN
      target/classes/com/sf/day07/lx/Cat.class
  44. BIN
      target/classes/com/sf/day07/lx/Coco.class
  45. BIN
      target/classes/com/sf/day07/lx/Cook.class
  46. BIN
      target/classes/com/sf/day07/lx/Dog.class
  47. BIN
      target/classes/com/sf/day07/lx/Drink.class
  48. BIN
      target/classes/com/sf/day07/lx/Employee.class
  49. BIN
      target/classes/com/sf/day07/lx/Father.class
  50. BIN
      target/classes/com/sf/day07/lx/Manager.class
  51. BIN
      target/classes/com/sf/day07/lx/SaltDrink.class
  52. BIN
      target/classes/com/sf/day07/lx/Son.class
  53. BIN
      target/classes/com/sf/day07/lx/Student.class
  54. BIN
      target/classes/com/sf/day07/lx/T.class
  55. BIN
      target/classes/com/sf/day07/lx/Te$t2.class
  56. BIN
      target/classes/com/sf/day07/lx/Te.class
  57. BIN
      target/classes/com/sf/day07/lx/Te2.class
  58. BIN
      target/classes/com/sf/day07/lx/Test1.class
  59. BIN
      target/classes/com/sf/day07/lx/TestCodeDiv.class
  60. BIN
      target/classes/com/sf/day07/lx/rew.class
  61. BIN
      target/classes/com/sf/sx2/Person.class
  62. BIN
      target/classes/com/sf/sx2/Person1.class
  63. BIN
      target/classes/com/sf/sx2/PersonUtils.class
  64. BIN
      target/classes/com/sf/sx2/Phone.class
  65. BIN
      target/classes/com/sf/sx2/Student.class
  66. BIN
      target/classes/com/sf/sx2/Te.class
  67. BIN
      target/classes/com/sf/sx2/Te2.class

+ 23 - 0
src/main/java/com/sf/day07/City.java

@@ -0,0 +1,23 @@
+package com.sf.day07;
+
+public class City extends Country{
+    String name;
+    public City(String name){
+        super(name);
+    }    public void print() {
+        name = "Shanghai";
+        super.print();      //调用父类的方法
+        System.out.println(this.name);
+        System.out.println(super.name);
+    }
+
+
+    public static void main(String[] args) {
+//        City c = new City();
+//        c.print();
+//        Country country = new Country();
+//        System.out.println(country.name);
+//        country.print();
+//        System.out.println(country.name);
+    }
+}

+ 14 - 0
src/main/java/com/sf/day07/Country.java

@@ -0,0 +1,14 @@
+package com.sf.day07;
+
+public class Country {
+
+    String name = "china属性";
+    public Country(){
+    }
+    public Country(String name){
+        this.name = name;
+    }
+    public void print(){
+        name = "china方法";
+    }
+}

+ 39 - 0
src/main/java/com/sf/day07/Person.java

@@ -0,0 +1,39 @@
+package com.sf.day07;
+
+public class Person {
+    private String name ="凤姐";
+    private int age = 20;
+
+    public Person() {
+        System.out.println("父类无参");
+    }
+
+    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 +
+                '}';
+    }
+}

+ 44 - 0
src/main/java/com/sf/day07/Student.java

@@ -0,0 +1,44 @@
+package com.sf.day07;
+
+public class Student extends Person{
+    private double score = 100;
+
+    public Student() {
+        //super(); // 调用父类无参构造方法,默认就存在,可以不写,必须再第一行
+        System.out.println("子类无参");
+    }
+
+    public Student(double score){
+        this.score = score;
+    }
+
+    public Student(String name ,int age,double score) {
+        super(name ,age);// 调用父类有参构造方法,初始化name和age
+        this.score = score;
+        System.out.println("子类有参");
+    }
+
+    public double getScore() {
+        return score;
+    }
+
+    public void setScore(double score) {
+        this.score = score;
+    }
+
+    @Override
+    public String toString() {
+        return "Student{" +
+                "score=" + score +
+                '}';
+    }
+
+    public static void main(String[] args) {
+        // 调用子类有参数构造方法
+        Student s2 = new Student("张三",20,99);
+        System.out.println(s2.getScore()); // 99
+        System.out.println(s2.getName()); // 输出 张三
+        System.out.println(s2.getAge()); // 输出 20
+        System.out.println(s2);
+    }
+}

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

@@ -0,0 +1,26 @@
+package com.sf.day07;
+
+public class Te {
+    static String name;
+    int age;
+    //  静态代码块
+    static {
+        name = "sad";
+
+    }
+    // 实例代码块
+    {
+        age = 12;
+        name = "21";
+    }
+
+    public void t(){
+        //  局部代码块
+        {
+            int n = 1;
+        }
+        System.out.println();
+
+    }
+
+}

+ 28 - 0
src/main/java/com/sf/day07/lx/Animal.java

@@ -0,0 +1,28 @@
+package com.sf.day07.lx;
+
+public class Animal {
+    String name = "mingzi";
+    public void eat(){
+        System.out.println("animal  --  eat~");
+
+    }
+
+
+    public static void main(String[] args) {
+        Animal animal = new Dog();
+        animal.eat();
+        String name1 = animal.name;
+//        animal.age;
+
+        System.out.println(name1);
+        //转型
+        if (animal instanceof Dog){
+            Dog dog  = (Dog) animal;
+            dog.eat();
+        }
+        Animal animal1 = new Cat();
+        animal1.eat();
+    }
+
+
+}

+ 33 - 0
src/main/java/com/sf/day07/lx/BuildCarsInterface.java

@@ -0,0 +1,33 @@
+package com.sf.day07.lx;
+
+public interface BuildCarsInterface {
+
+    //静态常量
+      int MAX_SPEED = 220;//km/h
+
+    int MIN_DISTANCE = 50; //m
+
+    //抽象方法
+    //参数 汽油
+    //返回 速度
+     void runCar();
+     void breakCar();
+
+    //默认方法
+    default void start(){
+        System.out.println("开始");
+    }
+    default void stop(){
+        System.out.println("结束");
+    }
+
+    //静态方法
+    static void show(){
+        System.out.println("中国汽车必将走向世界");
+    }
+
+    //私有提示
+    default void error(){
+        System.out.println("超速");
+    }
+}

+ 7 - 0
src/main/java/com/sf/day07/lx/BuildCarsInterface2.java

@@ -0,0 +1,7 @@
+package com.sf.day07.lx;
+
+public interface BuildCarsInterface2 {
+
+
+    void playMusic();
+}

+ 34 - 0
src/main/java/com/sf/day07/lx/BuildCarsInterfaceImpl.java

@@ -0,0 +1,34 @@
+package com.sf.day07.lx;
+
+public class BuildCarsInterfaceImpl implements BuildCarsInterface,BuildCarsInterface2{
+    @Override
+    public void runCar() {
+        System.out.println("汽车正在运行~");
+    }
+
+    @Override
+    public void breakCar() {
+        System.out.println("汽车刹车,必须在"+MIN_DISTANCE+"内停止");
+    }
+
+    @Override
+    public void start() {
+        System.out.println("impl    start~");
+    }
+
+
+
+
+
+
+    public static void main(String[] args) {
+      BuildCarsInterface buildCarsInterface =  new BuildCarsInterfaceImpl();//多态
+        buildCarsInterface.runCar();
+        buildCarsInterface.breakCar();
+    }
+
+    @Override
+    public void playMusic() {
+        System.out.println("汽车播放音乐");
+    }
+}

+ 9 - 0
src/main/java/com/sf/day07/lx/Cat.java

@@ -0,0 +1,9 @@
+package com.sf.day07.lx;
+
+public class Cat extends Animal{
+
+    @Override
+    public void eat() {
+        System.out.println("cat  --  eat~");
+    }
+}

+ 8 - 0
src/main/java/com/sf/day07/lx/Coco.java

@@ -0,0 +1,8 @@
+package com.sf.day07.lx;
+
+public class Coco extends Drink{
+    @Override
+    public void taste() {
+        System.out.println("我是可口可乐,我是甜汽水");
+    }
+}

+ 24 - 0
src/main/java/com/sf/day07/lx/Cook.java

@@ -0,0 +1,24 @@
+package com.sf.day07.lx;
+
+public class Cook extends Employee{
+
+    public Cook() {
+    }
+
+    public Cook(String id, String name, double salary) {
+        super(id, name, salary);
+    }
+
+    @Override
+    public void work() {
+        System.out.println("厨师炒菜多加点盐...");
+    }
+
+
+    public static void main(String[] args) {
+        Manager manager = new Manager();
+        manager.work();
+        Cook cook = new Cook();
+        cook.work();
+    }
+}

+ 15 - 0
src/main/java/com/sf/day07/lx/Dog.java

@@ -0,0 +1,15 @@
+package com.sf.day07.lx;
+
+public class Dog extends Animal{
+  int age;
+    @Override
+    public void eat() {
+        System.out.println("DOG  --  eat~");
+    }
+
+
+    public void protectHome(){
+        System.out.println("小狗看家");
+    }
+
+}

+ 9 - 0
src/main/java/com/sf/day07/lx/Drink.java

@@ -0,0 +1,9 @@
+package com.sf.day07.lx;
+
+public class Drink {
+
+
+    public void taste(){
+
+    }
+}

+ 18 - 0
src/main/java/com/sf/day07/lx/Employee.java

@@ -0,0 +1,18 @@
+package com.sf.day07.lx;
+
+public abstract class Employee {
+    private String name;
+    private String id;
+    private Double salary;
+    public Employee() {
+    }
+
+    public Employee(String id, String name, double salary) {
+        this.id = id;
+        this.name = name;
+        this.salary = salary;
+    }
+
+    //抽象方法
+    public abstract void work();
+}

+ 17 - 0
src/main/java/com/sf/day07/lx/Manager.java

@@ -0,0 +1,17 @@
+package com.sf.day07.lx;
+
+public class Manager extends Employee{
+
+    public Manager(){
+
+    }
+
+    public Manager(String id, String name, double salary) {
+        super(id, name, salary);
+    }
+
+    @Override
+    public void work() {
+        System.out.println("管理其他人");
+    }
+}

+ 31 - 0
src/main/java/com/sf/day07/lx/SaltDrink.java

@@ -0,0 +1,31 @@
+package com.sf.day07.lx;
+
+import java.util.Scanner;
+import java.util.Set;
+
+public class SaltDrink extends Drink{
+    @Override
+    public void taste() {
+        System.out.println("我是盐汽水,我是咸的");
+    }
+
+
+    public static   Drink  sell(String str){
+      if(str.equals("甜")){
+          Drink drink = new Coco();
+          drink.taste();
+      }else if (str.equals("咸")){
+          Drink drink = new SaltDrink();
+          drink.taste();
+      }
+      return null;
+    }
+
+
+    public static void main(String[] args) {
+        Scanner scanner = new Scanner(System.in);
+        String next = scanner.next();
+        sell(next);
+
+    }
+}

+ 41 - 0
src/main/java/com/sf/day07/lx/Student.java

@@ -0,0 +1,41 @@
+package com.sf.day07.lx;
+
+public class Student {
+    String name;
+    int age;
+    static  String major;
+
+    public Student() {
+    }
+
+    public Student(String name, int age) {
+        this.name = name;
+        this.age = age;
+    }
+    @Override
+    public String toString() {
+        return "Student{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                ", major='" + major + '\'' +
+                '}';
+    }
+
+    public static void main(String[] args) {
+        Student student = new Student("zhsa", 19);
+        student.major = "java";
+        System.out.println(student);
+
+
+        Student student1 = new Student();
+        student1.major = "web";
+        System.out.println(student1);
+
+        Student student2 = new Student();
+        System.out.println(student2);
+    }
+
+
+
+
+}

+ 12 - 0
src/main/java/com/sf/day07/lx/T.java

@@ -0,0 +1,12 @@
+package com.sf.day07.lx;
+
+public abstract class T {
+
+
+    public abstract   String getName();
+
+
+    public static void main(String[] args) {
+
+    }
+}

+ 31 - 0
src/main/java/com/sf/day07/lx/Te.java

@@ -0,0 +1,31 @@
+package com.sf.day07.lx;
+
+
+import com.alibaba.druid.support.http.util.IPAddress;
+
+public  class Te {
+
+     class  t2{
+
+    }
+
+    //定义一个常量
+    public static final  String IP_ADDRESS = null;
+
+    public int t1(final  int x){
+
+//        return ++x;
+        return x+1;
+
+    }
+    public static void staticMethod(){
+          final  String IP = "93r80";
+        System.out.println("staticMethod");
+    }
+
+    public    void method(){
+
+        System.out.println("method");
+    }
+
+}

+ 23 - 0
src/main/java/com/sf/day07/lx/Te2.java

@@ -0,0 +1,23 @@
+package com.sf.day07.lx;
+
+public class Te2 extends Te{
+
+    String name;
+    static  int age;
+
+    public static void t1(){
+        age = 12;
+//        this.name = "hsf";
+    }
+
+
+    @Override
+    public void method() {
+        super.method();
+    }
+
+
+
+
+
+}

+ 37 - 0
src/main/java/com/sf/day07/lx/Test1.java

@@ -0,0 +1,37 @@
+package com.sf.day07.lx;
+
+public class Test1 {
+    public static void main(String[] args) {
+        C c = new C();
+        c.showA();
+        c.showB();
+        c.showC();
+
+    }
+}
+
+abstract  class A{
+    int numa = 10;
+    public abstract void showA();
+}
+
+abstract   class B extends A{
+    int numb = 20;
+    public abstract void showB();
+}
+
+
+class  C extends B{
+    int numc = 30;
+    @Override
+    public void showB() {
+        System.out.println("B类中numb:" + numb);
+    }
+    @Override
+    public void showA() {
+        System.out.println("A类中numa:" + numa);
+    }
+    public void showC(){
+        System.out.println("C类中numc:" + numc);
+    }
+}

+ 29 - 0
src/main/java/com/sf/day07/lx/TestCodeDiv.java

@@ -0,0 +1,29 @@
+package com.sf.day07.lx;
+
+public class TestCodeDiv {
+    public static void main(String[] args) {
+        Son son = new Son();
+    }
+}
+class Father{
+    static{
+        System.out.println("(1)父类的静态代码块");
+    }
+    {
+        System.out.println("(2)父类的非静态代码块");
+    }
+    Father(){
+        System.out.println("(3)父类的无参构造");
+    }
+}
+class Son extends Father{
+    static{
+        System.out.println("(4)子类的静态代码块");
+    }
+    {
+        System.out.println("(5)子类的非静态代码块");
+    }
+    Son(){
+        System.out.println("(6)子类的无参构造");
+    }
+}

+ 4 - 0
src/main/java/com/sf/day07/lx/rew.java

@@ -0,0 +1,4 @@
+package com.sf.day07.lx;
+
+public interface rew {
+}

+ 0 - 45
src/main/java/com/sf/sx2/Person.java

@@ -1,45 +0,0 @@
-package com.sf.sx2;
-
-public class Person {
-
-
-    private Phone phone;
-
-    public Person(Phone phone) {
-        this.phone = phone;
-    }
-
-    public Person() {
-
-    }
-
-    public Phone getPhone() {
-        return phone;
-    }
-
-    public void setPhone(Phone phone) {
-        this.phone = phone;
-    }
-
-    @Override
-    public String toString() {
-        return "Person{" +
-                "phone=" + phone +
-                '}';
-    }
-
-
-    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);
-    }
-}

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

@@ -1,65 +0,0 @@
-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);
-
-    }
-
-}

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

@@ -1,11 +0,0 @@
-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;
-    }
-}

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

@@ -1,50 +0,0 @@
-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 +
-                '}';
-    }
-}

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

@@ -1,97 +0,0 @@
-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 测试。
-     */
-}

+ 0 - 102
src/main/java/com/sf/sx2/Te.java

@@ -1,102 +0,0 @@
-package com.sf.sx2;
-
-import org.junit.Test;
-
-public class Te {
-    /**
-     * 注释:三种
-     * 单行注释  //
-     * 多行
-     * 文档注释
-     * 启动:main函数
-     * public  static   void main(String[] args){
-     *     System.out.println("Hello");
-     *     System.out.println(123);
-     *     快捷键  psvm/main  +  enter
-     * }
-     * 打印到控制台上sout+enter
-     *
-     * 定义一个常量:public static final String IP_ADDRESS = "192.168.1.1";
-     *  数据类型:
-     *   基本数据类型:
-     *      整型:byte  short int  long
-     *      问题?4? 区别   选择   表数范围
-     *      计算机的最小单元(单位) 字节?    bit位
-     *      1字节  = 8bit
-     *  字节数: 1        2      4      8
-     *  内存和硬盘?
-     *  表述范围:-128  +127
-     *  需求1:用一个变量来计算小狗的年龄
-     *  需求1:用一个变量来计算人的年龄
-     *  byte  dogAge = 9;       √
-     *  short  dogAge = 9;
-     *  int  dogAge = 9;
-     *  long  dogAge = 9;
-     *  12  默认int
-     *  long num = 12L/l;
-     *
-     *      浮点型:float  double    12.3(double)
-     *      float num = 12.3F/f;
-     *      double num = 12.3F/f;
-     *      double num = 12.3D/d;
-     *      区别:精度不同   字节不同
-     *      4   8
-     *      6~7
-     *      开发建议:double
-     *      布尔类型:boolean   true   false(默认)
-     *      字符类型:char  字符串
-     *      区别 : ' '   " "   a   abc
-     *      字符和整型int  能不能进行运算?
-     *      答:能   ---  unicode码
-     *      编码集:
-     *      美国的编码集:ASCII
-     *      中国的编码集:GBK
-     *      全球编码集:unicode码    A  65       a  97
-     *      utf - 8 编码  实现之一
-     *      int num = (int)'A'+12;
-     *      int NUM = (int)'A'+12;
-     *      int    = 77;
-     *      char = '?';
-     *      强转的格式:  数据类型   标识符 = (数据类型) 变量名/逻辑运算
-     *
-     *   引用数据类型:
-     *   类   接口  数组
-     *
-     *   String    不是关键字  是数据类型 ,并且是数据类型中的引用数据类型
-     *
-     *
-     */
-    public static void main(String[] args) {
-//        System.out.println();
-//        System.out.println(Integer.MAX_VALUE);
-//        double num = 12.3F;
-//        byte num1 = 0;
-    //我心目中的男神是普京,我心目中的女神是韩红
-//        String manName = "金总";
-//        String womanName = "韩红";
-//        System.out.println("我心目中的男神是"+manName+",我心目中的女神是"+womanName);
-
-
-
-    }
-
-    @Test
-    public void t1(){
-        /**
-         * 获取两个数中的较大数
-         * (条件表达式)?值1:值2;
-          */
-        int m = 12,n = 100,b = 123;
-//        int max = (m > n)?m:n;
-//        System.out.println(max);
-        // 获取三个数中的最大值
-       int max1 = (m>n)?m:n;
-       int max = (max1>b)?max1:b;
-        System.out.println(max);
-        /**
-         * 用一行代码去写
-         */
-      max =  ((max = (m>n)?m:n)>b)?max:b;
-        System.out.println(max);
-    }
-}

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

@@ -1,542 +0,0 @@
-package com.sf.sx2;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Scanner;
-
-public class Te2 {
-    /**
-     * 从键盘输入
-     * @param args
-     */
-    public static void main(String[] args) {
-        /**
-         * 从键盘输入   通过java提供的Scanner类
-         * 提供了一些方法   数据类型
-         * eg:  1    1.1      hello   A
-         * 1、创建Scanner类的这个对象
-         *  Scanner scanner = new Scanner(System.in);
-         *  System.in  :  输入流   InputStream
-         *  整型:nextInt
-         *  字符串:next
-         *  字符:next().charAt(index)
-         *  eg:Hello   0 -->  H
-         *
-         */
-//        Scanner scanner = new Scanner(System.in);
-//        char c = scanner.next().charAt(0);
-//        int nextInt = scanner.nextInt();
-//        scanner.close();  // 学习阶段   关不关都可以
-
-        /**
-         * 请输入你的网名(String)、你的年龄(int)、
-         * 你的体重(double)、你是否单身(boolean)、
-         * 你的性别(int    1男   2 女)等情况。
-         */
-//        Scanner scanner = new Scanner(System.in);
-//        System.out.println("请输入网名~");
-//        String name = scanner.next();
-//        System.out.println(name);
-//        System.out.println("请输入年龄~");
-//        int age = scanner.nextInt();
-//        System.out.println(age);
-//        System.out.println("请输入体重~");
-//        double weight = scanner.nextDouble();
-//        System.out.println(weight);
-//        System.out.println("请输入是否单身~");
-//        boolean single = scanner.nextBoolean();
-//        System.out.println(single);
-//        System.out.println("请输入您的性别,int  1男 2 女");
-//        int sex = scanner.nextInt();
-//        if(sex == 1)
-//            System.out.println("男");
-//        else
-//        System.out.println("女");
-//        scanner.close();
-
-        /**
-         * 大家都知道,如果想成为一名ikun,当然要提出一定的条件:是否中分:是; 背带裤:是; 篮球:是。
-         * 如果这三个条件同时满足,则:“真爱粉”
-         * 如果三个条件有为真的情况,则:“假ikun”
-         * 如果三个条件都不满足,则:“小黑子!”
-         */
-//        Scanner scanner = new Scanner(System.in);
-//        System.out.println("是否中分:是;");
-//        String next1 = scanner.next();
-//        String next2 = scanner.next();
-//        String next3 = scanner.next();
-//        System.out.println(next1);
-//        System.out.println(next2);
-//        System.out.println(next3);
-//        if(next1.equals("是") && next2.equals("是") && next3.equals("是")){
-//            System.out.println("真爱粉");
-//        }else if (next1.equals("是") || next2.equals("是") || next3.equals("是")){
-//            System.out.println("假爱粉");
-//        }else {
-//            System.out.println("黑粉");
-//        }
-
-        /**
-         * 我家的狗n岁了,n岁的狗相当于人类多大呢?
-         * 其实,狗的前两年每一年相当于人类的10.5岁,
-         * 之后每增加一年就增加四岁。那么5岁的狗相当于人类多少年龄呢?
-         * 应该是:10.5 + 10.5 + 4 + 4 + 4 = 33岁。
-         */
-//        Scanner scanner = new Scanner(System.in);
-//        int dogAge = scanner.nextInt();
-//        double personAge = 0;
-//        if(dogAge < 0){
-//            System.out.println("不合法~~");
-//        } else if (dogAge <= 2 &&  dogAge>0){
-//            personAge = dogAge*10.5;
-//        }else {
-//            personAge = 2*10.5 + (dogAge - 2)*4;
-//        }
-//        System.out.println("5岁的小狗相当于人的"+personAge+"岁~");
-        Scanner scanner = new Scanner(System.in);
-        boolean flag = true;
-        while (flag){
-            int month = scanner.nextInt();
-            switch (month){
-                case 1:
-                case 2:
-                case 3:
-                    System.out.println("春季");
-                    flag = false;
-                    break;
-                case 4:
-                case 5:
-                case 6:
-                    System.out.println("夏季");
-                    flag = false;
-                    break;
-                case 7:
-                case 8:
-                case 9:
-                    System.out.println("秋季");
-                    flag = false;
-                    break;
-                case 10:
-                case 11:
-                case 12:
-                    System.out.println("冬季");
-                    flag = false;
-                    break;
-                default:
-                    System.out.println("输入有误,请重新输入~");
-            }
-        }
-
-    }
-
-    @Test
-    public void t1(){
-        /**
-         * 随机数
-         * Math.random();   [0,1)
-         * new Random();
-         */
-        System.out.println(Math.random());
-        //[5,104]   int
-        //  int  [a,b]   --> Math.random()*(b-a+1)+a
-        for (int i= 0;i<10;i++){
-            System.out.println(Math.random()*100+5);
-        }
-    }
-
-    @Test
-    public void t2(){
-
-        /**
-         * switch case
-         * 语法结构:
-         * switch(变量){
-         * csae 常量1:
-         *
-         * break;
-         * csae 常量2:
-         *
-         * csae 常量3:
-         *
-         * default:
-         *  ps:case穿透
-         *
-         * }
-         */
-
-        String season = "summer";
-        switch (season){
-            case "spring":
-                System.out.println("春天~");
-                break;
-            case "summer":
-                System.out.println("夏天~");
-                break;   //终止 结束
-            case "autumn":
-                System.out.println("秋天~");
-                break;
-            case "winter":
-                System.out.println("冬天~");
-                break;
-            default:
-                System.out.println("输入有误~");
-                break;
-        }
-    }
-    @Test
-    public void t3(){
-        /**
-         * //键盘输入指定月份,打印该月份所属的季节。
-         * 假如 :
-         * 1,2,3   春季
-         * 4,5,6   夏季
-         * 7,8,9   秋季
-         * 10,11,12冬季
-         */
-        int month = 1;
-        switch (month){
-            case 1:
-            case 2:
-            case 3:
-                System.out.println("春季");
-                break;
-            case 4:
-            case 5:
-            case 6:
-                System.out.println("夏季");
-                break;
-            case 7:
-            case 8:
-            case 9:
-                System.out.println("秋季");
-                break;
-            case 10:
-            case 11:
-            case 12:
-                System.out.println("冬季");
-                break;
-            default:
-                System.out.println("输入有误~12");
-        }
-    }
-
-    @Test
-    public void t6(){
-        /**
-         * for循环
-         * 语法结构:
-         * 1、初始化部分  int i = 0;   //index
-         * 2、条件判断部分  for终止条件 (出口)
-         * 3、迭代部分
-         * 4、代码体部分
-         * 执行流程:1  2   4 3   2 4 3  2
-         * for( 1-int i = 0; 2- i<10; 3-i++){
-         *     // 4-代码体
-         *     for(){
-         *
-         * }
-         *
-         *eg:打印1~100之间所有奇数的和
-         *
-         *
-         *
-         *
-         * while(){
-         *
-         * }
-         *
-         *
-         * do{
-         *
-         * }while();
-         *
-         * for(){};   //  次数
-         *
-         *
-         */
-        int sum = 0;
-        for (int i = 1;i<101;i++){
-            if(i % 2 != 0){
-               sum += i;
-            }
-        }
-        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/day07/City.class


BIN
target/classes/com/sf/day07/Country.class


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


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


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


BIN
target/classes/com/sf/day07/lx/A.class


BIN
target/classes/com/sf/day07/lx/Animal.class


BIN
target/classes/com/sf/day07/lx/B.class


BIN
target/classes/com/sf/day07/lx/BuildCarsInterface.class


BIN
target/classes/com/sf/day07/lx/BuildCarsInterfaceImpl.class


BIN
target/classes/com/sf/day07/lx/C.class


BIN
target/classes/com/sf/day07/lx/Cat.class


BIN
target/classes/com/sf/day07/lx/Coco.class


BIN
target/classes/com/sf/day07/lx/Cook.class


BIN
target/classes/com/sf/day07/lx/Dog.class


BIN
target/classes/com/sf/day07/lx/Drink.class


BIN
target/classes/com/sf/day07/lx/Employee.class


BIN
target/classes/com/sf/day07/lx/Father.class


BIN
target/classes/com/sf/day07/lx/Manager.class


BIN
target/classes/com/sf/day07/lx/SaltDrink.class


BIN
target/classes/com/sf/day07/lx/Son.class


BIN
target/classes/com/sf/day07/lx/Student.class


BIN
target/classes/com/sf/day07/lx/T.class


BIN
target/classes/com/sf/day07/lx/Te$t2.class


BIN
target/classes/com/sf/day07/lx/Te.class


BIN
target/classes/com/sf/day07/lx/Te2.class


BIN
target/classes/com/sf/day07/lx/Test1.class


BIN
target/classes/com/sf/day07/lx/TestCodeDiv.class


BIN
target/classes/com/sf/day07/lx/rew.class


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


BIN
target/classes/com/sf/sx2/Person1.class


BIN
target/classes/com/sf/sx2/PersonUtils.class


BIN
target/classes/com/sf/sx2/Phone.class


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


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


BIN
target/classes/com/sf/sx2/Te2.class