xerga 2 vuotta sitten
vanhempi
commit
422dbd7c5e
72 muutettua tiedostoa jossa 815 lisäystä ja 0 poistoa
  1. 1 0
      JavaSE/.idea/modules.xml
  2. 22 0
      JavaSE/day09/src/com/lovecoding/day09/Fu.java
  3. 8 0
      JavaSE/day09/src/com/lovecoding/day09/TestZiInit.java
  4. 13 0
      JavaSE/day09/src/com/lovecoding/day09/Zi.java
  5. 11 0
      JavaSE/day10/day10.iml
  6. 32 0
      JavaSE/day10/src/com/lovecoding/day10/cons/Student.java
  7. 22 0
      JavaSE/day10/src/com/lovecoding/day10/cons/Test01.java
  8. 17 0
      JavaSE/day10/src/com/lovecoding/day10/cons/TestStudent.java
  9. 53 0
      JavaSE/day10/src/com/lovecoding/day10/cons01/Student.java
  10. 26 0
      JavaSE/day10/src/com/lovecoding/day10/cons01/TestStudent.java
  11. 34 0
      JavaSE/day10/src/com/lovecoding/day10/cons02/Father.java
  12. 25 0
      JavaSE/day10/src/com/lovecoding/day10/cons02/Son.java
  13. 13 0
      JavaSE/day10/src/com/lovecoding/day10/cons02/TestFather.java
  14. 12 0
      JavaSE/day10/src/com/lovecoding/day10/cons02/TestSon.java
  15. 67 0
      JavaSE/day10/src/com/lovecoding/day10/ex01/Person.java
  16. 15 0
      JavaSE/day10/src/com/lovecoding/day10/ex01/TestPerson.java
  17. 23 0
      JavaSE/day10/src/com/lovecoding/day10/ex02/Test01.java
  18. 7 0
      JavaSE/day10/src/com/lovecoding/day10/ex03/Person.java
  19. 15 0
      JavaSE/day10/src/com/lovecoding/day10/ex03/Teacher.java
  20. 35 0
      JavaSE/day10/src/com/lovecoding/day10/ex03/Test1.java
  21. 33 0
      JavaSE/day10/src/com/lovecoding/day10/ex03/Test2.java
  22. 23 0
      JavaSE/day10/src/com/lovecoding/day10/ex03/ex04/TestOther.java
  23. 64 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian01/TestGuanJianZi.java
  24. 38 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian02/Test.java
  25. 40 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian03/Test01.java
  26. 31 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian04/TestFinal.java
  27. 56 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian05/Person.java
  28. 79 0
      JavaSE/day10/src/com/lovecoding/day10/guanjian05/TestPerson.java
  29. BIN
      JavaSE/out/production/day09/com/lovecoding/day09/Fu.class
  30. BIN
      JavaSE/out/production/day09/com/lovecoding/day09/TestZiInit.class
  31. BIN
      JavaSE/out/production/day09/com/lovecoding/day09/Zi.class
  32. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons/A.class
  33. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons/B.class
  34. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons/Student.class
  35. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons/Test01.class
  36. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons/TestStudent.class
  37. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons01/Student.class
  38. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons01/TestStudent.class
  39. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons02/Father.class
  40. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons02/Son.class
  41. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons02/TestFather.class
  42. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/cons02/TestSon.class
  43. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex01/Person.class
  44. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex01/TestPerson.class
  45. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex02/A.class
  46. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex02/B.class
  47. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex02/Test01.class
  48. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Base.class
  49. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Father.class
  50. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Person.class
  51. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Son.class
  52. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Sub.class
  53. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Teacher.class
  54. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Test1.class
  55. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/Test2.class
  56. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/ex04/Other.class
  57. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/ex03/ex04/TestOther.class
  58. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/AAA.class
  59. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/BBB.class
  60. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/TestGuanJianZi.class
  61. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Father.class
  62. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Son.class
  63. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Test.class
  64. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Daughter.class
  65. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Father.class
  66. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Son.class
  67. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Test01.class
  68. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/A.class
  69. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/B.class
  70. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/TestFinal.class
  71. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian05/Person.class
  72. BIN
      JavaSE/out/production/day10/com/lovecoding/day10/guanjian05/TestPerson.class

+ 1 - 0
JavaSE/.idea/modules.xml

@@ -10,6 +10,7 @@
       <module fileurl="file://$PROJECT_DIR$/day07/day07.iml" filepath="$PROJECT_DIR$/day07/day07.iml" />
       <module fileurl="file://$PROJECT_DIR$/day08/day08.iml" filepath="$PROJECT_DIR$/day08/day08.iml" />
       <module fileurl="file://$PROJECT_DIR$/day09/day09.iml" filepath="$PROJECT_DIR$/day09/day09.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day10/day10.iml" filepath="$PROJECT_DIR$/day10/day10.iml" />
     </modules>
   </component>
 </project>

+ 22 - 0
JavaSE/day09/src/com/lovecoding/day09/Fu.java

@@ -0,0 +1,22 @@
+package com.lovecoding.day09;
+
+public class Fu {
+    static{
+        System.out.println("Fu静态代码块1,a = " + Fu.a);
+    }
+    private static int a = 1;
+    static{
+        System.out.println("Fu静态代码块2,a = " + a);
+    }
+
+    {
+        System.out.println("Fu非静态代码块");
+    }
+    public Fu(){
+        System.out.println("Fu构造器");
+    }
+
+    public static void method(){
+        System.out.println("Fu.method");
+    }
+}

+ 8 - 0
JavaSE/day09/src/com/lovecoding/day09/TestZiInit.java

@@ -0,0 +1,8 @@
+package com.lovecoding.day09;
+
+public class TestZiInit {
+    public static void main(String[] args) {
+        Zi z1 = new Zi();
+        Zi z2 = new Zi();
+    }
+}

+ 13 - 0
JavaSE/day09/src/com/lovecoding/day09/Zi.java

@@ -0,0 +1,13 @@
+package com.lovecoding.day09;
+
+public class Zi extends Fu{
+    static{
+        System.out.println("Zi静态代码块");
+    }
+    {
+        System.out.println("Zi非静态代码块");
+    }
+    public Zi(){
+        System.out.println("Zi构造器");
+    }
+}

+ 11 - 0
JavaSE/day10/day10.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 32 - 0
JavaSE/day10/src/com/lovecoding/day10/cons/Student.java

@@ -0,0 +1,32 @@
+package com.lovecoding.day10.cons;
+
+public class Student {
+
+    String name;
+
+//    //构造方法 没有构造方法 系统默认给出
+//    无参的构造方法
+    public Student(){
+        System.out.println("无参的构造方法");
+    }
+
+    //当有了 有参数的构造方法 系统不会提供无参数的构造方法
+    public Student(String name){
+        this.name = name;
+        System.out.println("有参的构造方法:"+name);
+    }
+
+    //两个构造方法之间可以重载
+    public Student(String name , int age){
+        //this调用 其他构造方法 this 必须在第一行
+        this(name,age,"1001");
+        System.out.println("两个参数的构造方法:"+name+":"+age);
+    }
+
+
+    //this调用
+    //this(参数)
+    public Student(String name , int age, String number){
+        System.out.println("三个参数的构造方法:"+name+":"+age+":"+number);
+    }
+}

+ 22 - 0
JavaSE/day10/src/com/lovecoding/day10/cons/Test01.java

@@ -0,0 +1,22 @@
+package com.lovecoding.day10.cons;
+
+public class Test01 {
+    public static void main(String[] args) {
+          new B();
+
+
+    }
+
+}
+class A{
+    public A(){
+        System.out.println("A");
+    }
+}
+
+class B extends  A{
+    public B(){
+        //没有this 默认的super() 调用父类的构造方法
+        System.out.println("B");
+    }
+}

+ 17 - 0
JavaSE/day10/src/com/lovecoding/day10/cons/TestStudent.java

@@ -0,0 +1,17 @@
+package com.lovecoding.day10.cons;
+
+public class TestStudent {
+    public static void main(String[] args) {
+
+        //创建
+        Student student = new Student(); //无参数
+
+        //Student student = new Student("zs"); //有参数
+
+        //System.out.println("name:"+student.name);
+
+        //两个参数的构造方法
+        Student student1 = new Student("zs",12);
+
+    }
+}

+ 53 - 0
JavaSE/day10/src/com/lovecoding/day10/cons01/Student.java

@@ -0,0 +1,53 @@
+package com.lovecoding.day10.cons01;
+
+import java.util.Date;
+
+public class Student {
+
+    String name;
+    int age;
+    char gender;
+
+    //代码块
+    {
+        //当前时间
+        System.out.println(new Date(System.currentTimeMillis()));
+
+        //初始化赋值
+        this.name = " 李四 ";
+        this.age = 24;
+        this.gender = '女';
+    }
+
+    //创建对象 显示创建对象完成的时间
+    public Student() {
+
+    }
+
+    public Student(String name) {
+
+        this.name = name;
+    }
+
+    public Student(String name, int age) {
+
+        this.name = name;
+        this.age = age;
+    }
+
+    public Student(String name, int age, char gender) {
+
+        this.name = name;
+        this.age = age;
+        this.gender = gender;
+    }
+
+    @Override
+    public String toString() {
+        return "Student{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                ", gender=" + gender +
+                '}';
+    }
+}

+ 26 - 0
JavaSE/day10/src/com/lovecoding/day10/cons01/TestStudent.java

@@ -0,0 +1,26 @@
+package com.lovecoding.day10.cons01;
+
+public class TestStudent {
+
+
+    public static void main(String[] args) throws InterruptedException {
+
+
+        Student student1 = new Student();
+        System.out.println(student1);
+        Thread.sleep(1000);
+
+        Student student2 = new Student("张三");
+        System.out.println(student2);
+        Thread.sleep(1000);
+
+        Student student3 = new Student("张三",22);
+        System.out.println(student3);
+        Thread.sleep(1000);
+
+        Student student4 = new Student("张三",22,'男');
+        System.out.println(student4);
+
+
+    }
+}

+ 34 - 0
JavaSE/day10/src/com/lovecoding/day10/cons02/Father.java

@@ -0,0 +1,34 @@
+package com.lovecoding.day10.cons02;
+
+public class Father {
+
+    //显示赋值
+    private int a = 1;
+    public Father(){
+        System.out.println("Father类的无参构造");
+    }
+
+    public Father(int a, int b){
+        System.out.println("Father类的有参构造");
+        this.a = a;
+        this.b = b;
+    }
+
+    {
+        System.out.println("Father类的非静态代码块1,a = " + a);
+        System.out.println("Father类的非静态代码块1,b = " + this.b);
+    }
+
+
+    private int b = 1;
+
+    {
+        System.out.println("Father类的非静态代码块2,a = " + a);
+        System.out.println("Father类的非静态代码块2,b = " + b);
+    }
+
+    public String getInfo(){
+        return "a = " + a + ",b = " + b;
+    }
+}
+

+ 25 - 0
JavaSE/day10/src/com/lovecoding/day10/cons02/Son.java

@@ -0,0 +1,25 @@
+package com.lovecoding.day10.cons02;
+
+public class Son  extends  Father{
+    private int c = 1;
+
+    {
+        System.out.println("Son类的非静态代码块,c = " + c);
+    }
+
+    public Son() {
+        //super()
+        System.out.println("Son类的无参构造");
+    }
+
+    public Son(int a, int b, int c) {
+        super(a, b);
+        this.c = c;
+        System.out.println("Son类的有参构造");
+    }
+
+    @Override
+    public String getInfo() {
+        return super.getInfo() + ",c = " + c;
+    }
+}

+ 13 - 0
JavaSE/day10/src/com/lovecoding/day10/cons02/TestFather.java

@@ -0,0 +1,13 @@
+package com.lovecoding.day10.cons02;
+
+public class TestFather {
+    public static void main(String[] args) {
+        Father f1 = new Father();
+        System.out.println(f1.getInfo());
+
+        System.out.println("-----------------------");
+
+        Father f2 = new Father(10,10);
+        System.out.println(f2.getInfo());
+    }
+}

+ 12 - 0
JavaSE/day10/src/com/lovecoding/day10/cons02/TestSon.java

@@ -0,0 +1,12 @@
+package com.lovecoding.day10.cons02;
+
+public class TestSon {
+    public static void main(String[] args) {
+        Son s1 = new Son();
+        System.out.println(s1.getInfo());
+
+        System.out.println("---------------");
+        Son s2 = new Son(10,10,10);
+        System.out.println(s2.getInfo());
+    }
+}

+ 67 - 0
JavaSE/day10/src/com/lovecoding/day10/ex01/Person.java

@@ -0,0 +1,67 @@
+package com.lovecoding.day10.ex01;
+
+public class Person {
+
+    private String name;
+    private int age;
+    private int gender; // 1 男  0 女
+    //private char sex; // '男'   '女'
+
+
+    public Person(){
+        System.out.println("无参数");
+    }
+
+    public Person(String name , int age , int gender ){
+        this.name = name;
+        this.age = age;
+        this.gender = gender;
+    }
+
+    public Person(String name , int age ){
+        this.name = name;
+        this.age = age;
+    }
+
+    public Person(String name  ){
+        this.name = name;
+    }
+
+    public Person(int gender ,String name ){
+        this.name = name;
+        this.gender = gender;
+    }
+
+
+    public void showInfo(){
+        System.out.println("name:"+name+",age:"+age+",gender:"+gender);
+    }
+
+
+
+
+
+    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;
+    }
+
+    public int getGender() {
+        return gender;
+    }
+
+    public void setGender(int gender) {
+        this.gender = gender;
+    }
+}

+ 15 - 0
JavaSE/day10/src/com/lovecoding/day10/ex01/TestPerson.java

@@ -0,0 +1,15 @@
+package com.lovecoding.day10.ex01;
+
+public class TestPerson {
+
+    public static void main(String[] args) {
+
+        Person person1 = new Person();
+        person1.showInfo();
+
+
+        Person person2 = new Person("zs",22,1);
+        person2.showInfo();
+
+    }
+}

+ 23 - 0
JavaSE/day10/src/com/lovecoding/day10/ex02/Test01.java

@@ -0,0 +1,23 @@
+package com.lovecoding.day10.ex02;
+
+public class Test01 {
+    public static void main(String[] args) {
+        A a = new B();
+        System.out.println(a.num);
+        System.out.println(((B)a).num);
+        System.out.println(((A)((B)a)).num);
+
+        System.out.println("-------------------");
+
+        B b = new B();
+        System.out.println(b.num);
+        System.out.println(((A)b).num);
+        System.out.println(((B)((A)b)).num);
+    }
+}
+class A{
+    int num = 1;
+}
+class B extends A{
+    int num = 2;
+}

+ 7 - 0
JavaSE/day10/src/com/lovecoding/day10/ex03/Person.java

@@ -0,0 +1,7 @@
+package com.lovecoding.day10.ex03;
+
+public class Person {
+    public Person(){
+        System.out.println("1 this is a Person.");
+    }
+}

+ 15 - 0
JavaSE/day10/src/com/lovecoding/day10/ex03/Teacher.java

@@ -0,0 +1,15 @@
+package com.lovecoding.day10.ex03;
+
+public class Teacher {
+    private String name = "2 tom";
+    public Teacher(){
+        System.out.println("this is a teacher.");
+        //super();//编译报错,因为super()只能出现在构造器的首行
+
+    }
+
+    public static void main(String[] args){
+        Teacher tea = new Teacher();
+        //System.out.println(this.name);//编译报错 在静态方法中不能出现this
+    }
+}

+ 35 - 0
JavaSE/day10/src/com/lovecoding/day10/ex03/Test1.java

@@ -0,0 +1,35 @@
+package com.lovecoding.day10.ex03;
+
+public class Test1 {
+    public static void main(String[] args){
+        Son s1 = new Son(); //代码块 构造器 继承重写
+
+    }
+}
+class Father{
+    private int a = getNumber();
+    {
+        System.out.println("1 Father非静态代码块 a = " + a);
+    }
+    Father(){
+        System.out.println("2 Father()无参构造");
+    }
+    public int getNumber(){
+        System.out.println("3 Father:getNumber()");
+        return 1;
+    }
+}
+class Son extends Father{
+    {
+        System.out.println("4 Son非静态代码");
+    }
+    public Son(){
+        //super();
+        System.out.println("5 Son():无参构造");
+    }
+    @Override
+    public int getNumber(){
+        System.out.println("6 Son:getNumber()");
+        return 2;
+    }
+}

+ 33 - 0
JavaSE/day10/src/com/lovecoding/day10/ex03/Test2.java

@@ -0,0 +1,33 @@
+package com.lovecoding.day10.ex03;
+
+public class Test2 {
+    public static void main(String[] args) {
+        Sub s = new Sub();
+    }
+}
+class Base{
+    Base(){
+        //s
+        System.out.println(this);
+        this.method(100);
+    }
+    {
+        System.out.println("1 base");
+    }
+    public void method(int i){
+        System.out.println("2 base : " + i);
+    }
+}
+class Sub extends Base{
+    Sub(){
+        super();
+        super.method(70);
+    }
+    {
+        System.out.println("3 sub");
+    }
+    @Override
+    public void method(int j){
+        System.out.println("4 sub : " + j);
+    }
+}

+ 23 - 0
JavaSE/day10/src/com/lovecoding/day10/ex03/ex04/TestOther.java

@@ -0,0 +1,23 @@
+package com.lovecoding.day10.ex03.ex04;
+
+public class TestOther {
+
+    public static void main(String[] args) {
+
+        Other o = new Other(); //@0x1122
+
+        new TestOther().addOne(o); //匿名对象.方法()
+
+        System.out.println(o.i);
+    }
+
+    public void addOne(final Other o){ // final 修饰的变量 赋值一次 不能修改 @0x1122
+        o.i++; //改变的是i
+
+        // o = new Other(); //不能修改 报错
+    }
+}
+
+class Other{
+     public int i; //需要修饰i为final 才能报错
+}

+ 64 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian01/TestGuanJianZi.java

@@ -0,0 +1,64 @@
+package com.lovecoding.day10.guanjian01;
+
+public class TestGuanJianZi {
+
+    public static void main(String[] args) {
+        BBB bbb = new BBB();
+//        bbb.a();
+        bbb.b();
+
+//        AAA aaa = new AAA();
+//        aaa.a();
+//
+//        AAA ab = new BBB();
+//        ab.a();
+    }
+
+}
+
+class AAA{
+    String a;
+
+    {
+        this.a="a";
+    }
+
+    public AAA() {
+        this.a = "a";
+    }
+
+    public void a(){
+        System.out.println(this);
+        System.out.println("a,"+this.a);
+    }
+}
+
+class BBB extends AAA{
+    String b;
+
+    {
+        System.out.println(super.a);
+    }
+
+    public BBB() {
+        super();
+    }
+
+    public BBB(String b) {
+        //构造器
+        this.b = b;
+    }
+
+    public void b(){
+
+        this.a();
+        System.out.println(super.a);
+        super.a();
+        System.out.println("b"+this.b);
+    }
+
+    public void c(){
+        System.out.println("b");
+    }
+
+}

+ 38 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian02/Test.java

@@ -0,0 +1,38 @@
+package com.lovecoding.day10.guanjian02;
+
+class Father{
+    int a = 10;
+    int b = 11;
+}
+class Son extends Father{
+    int a = 20;
+    public void test(){
+        //子类与父类的属性同名,子类对象中就有两个a
+        System.out.println("子类的a:" + a);//20  先找局部变量找,没有再从本类成员变量找
+        System.out.println("子类的a:" + this.a);//20   先从本类成员变量找
+        System.out.println("父类的a:" + super.a);//10    直接从父类成员变量找
+        //子类与父类的属性不同名,是同一个b
+        System.out.println("b = " + b);//11  先找局部变量找,没有再从本类成员变量找,没有再从父类找
+        System.out.println("b = " + this.b);//11   先从本类成员变量找,没有再从父类找
+        System.out.println("b = " + super.b);//11  直接从父类局部变量找
+    }
+    public void method(int a, int b){
+        //子类与父类的属性同名,子类对象中就有两个成员变量a,此时方法中还有一个局部变量a
+        System.out.println("局部变量的a:" + a);//30  先找局部变量
+        System.out.println("子类的a:" + this.a);//20  先从本类成员变量找
+        System.out.println("父类的a:" + super.a);//10  直接从父类成员变量找
+        System.out.println("b = " + b);//13  先找局部变量
+        System.out.println("b = " + this.b);//11  先从本类成员变量找
+        System.out.println("b = " + super.b);//11  直接从父类局部变量找
+    }
+    public Son(){
+        super();
+    }
+}
+public class Test{
+    public static void main(String[] args){
+        Son son = new Son();
+        son.test();
+        son.method(30,13);
+    }
+}

+ 40 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian03/Test01.java

@@ -0,0 +1,40 @@
+package com.lovecoding.day10.guanjian03;
+
+class Father {
+    private int num = 10; ////子类没有重写方法时 权限修饰符 对变量没有影响
+    public int getNum() {
+        return num;
+    }
+}
+
+class Son extends Father{
+    public int num = 20;
+    public void test(){
+        System.out.println(getNum()); // 10
+        System.out.println(this.getNum()); //10
+        System.out.println(super.getNum()); //10
+    }
+}
+class Daughter extends Father{
+    public int num = 20;
+    @Override
+    public int getNum() {
+        return num;
+    }
+    public void test(){
+        System.out.println(getNum());  // 20
+        System.out.println(this.getNum()); //20
+        System.out.println(super.getNum()); // 10
+    }
+}
+public class Test01 {
+    public static void main(String[] args) {
+        //子类没有重写方法时 权限修饰符 对变量没有影响
+        Son son = new Son();
+        son.test();
+        System.out.println("--------------------");
+        //子类重写方法时 权限修饰符 对变量没有影响 先从本类中查找
+        Daughter daughter = new Daughter();
+        daughter.test();
+    }
+}

+ 31 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian04/TestFinal.java

@@ -0,0 +1,31 @@
+package com.lovecoding.day10.guanjian04;
+
+public class TestFinal {
+
+    public static void main(String[] args) {
+
+        final int a ;
+        a = 10; //赋值
+        //a = 11; //修改
+    }
+}
+
+
+/*final*/ class A {
+    public /*final*/  void a(){
+        System.out.println("a");
+    }
+}
+
+class B extends A{ //不能继承
+
+    final int b =  1;
+
+    @Override
+    public void a() { //不能重写
+        //b = 2; //不能改
+        System.out.println("b");
+    }
+}
+
+

+ 56 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian05/Person.java

@@ -0,0 +1,56 @@
+package com.lovecoding.day10.guanjian05;
+
+import java.util.Objects;
+
+public class Person {
+
+    private String name;
+    private int age;
+
+    public Person(String name, int age) {
+        this.name = name;
+        this.age = age;
+    }
+
+    public Person() {
+    }
+
+    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() {
+        System.out.println(Objects.hash(name));
+        return "Person{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                '}';
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o){ return true;};
+        if (o == null || getClass() != o.getClass()){ return false;};
+        Person person = (Person) o;
+        return age == person.age && Objects.equals(name, person.name);
+    }
+
+    @Override
+    public int hashCode() {
+        System.out.println(Objects.hash(name));
+        return Objects.hash(name);
+    }
+}

+ 79 - 0
JavaSE/day10/src/com/lovecoding/day10/guanjian05/TestPerson.java

@@ -0,0 +1,79 @@
+package com.lovecoding.day10.guanjian05;
+
+public class TestPerson {
+    public static void main(String[] args) {
+
+//        Person person = new Person();
+//        //输出对象的时候就是调用toString
+//        System.out.println(person);
+//        //toString
+//        System.out.println(person);
+//
+//        /*
+//        public void println(String x) {}
+//
+//        public void println(Object x) { //兼容匹配 多态参数
+//         */
+//
+//        System.out.println("-----------------------------");
+//
+//        Object obj = new Person();
+//
+//        //class 属性 方法 构造方法 都存在 class
+//        Class<?> aClass = obj.getClass();
+//        System.out.println(aClass);
+//
+//        //方法
+//        Method[] methods = aClass.getMethods();
+//        System.out.println(Arrays.toString(methods));
+//
+//        //属性
+//        Field[] fields = aClass.getDeclaredFields();
+//        fields[0].setAccessible(true);
+//        System.out.println(fields[0]);
+//
+//        //Object o = aClass.newInstance();
+//
+//        System.out.println("----------------------------");
+//
+//        Person p1 = new Person();
+//        Person p2 = new Person();
+//
+//        System.out.println(p1.equals(p2));
+//
+//        System.out.println(1==1);
+
+
+        /*
+        public boolean equals(Object obj) {
+            return (this == obj);
+        }
+         */
+
+        //比较 对象内容 需要重写比较规则
+
+        Person p11 = new Person("Aa",11);
+        Person p22 = new Person("BB",11);
+
+        System.out.println(p11.equals(p22));
+        System.out.println(p11);
+        System.out.println(p22);
+        //调用equals方法之前
+        //先调用hashcode值,确定是否是相同对象 调用equals比较。
+
+        //hashcode 相同, 对象不一定相同 , 相同的对象hashcode一定相同
+
+        String a = "Aa";
+        String b = "Aa";
+
+        System.out.println(a.equals(b)); //String 中比较的你内容 , 没有重写比较的 地址
+
+
+        String a1 = "Aa";
+        String b1 = "BB";
+
+        System.out.println(a1.hashCode());
+        System.out.println(b1.hashCode());
+
+    }
+}

BIN
JavaSE/out/production/day09/com/lovecoding/day09/Fu.class


BIN
JavaSE/out/production/day09/com/lovecoding/day09/TestZiInit.class


BIN
JavaSE/out/production/day09/com/lovecoding/day09/Zi.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons/A.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons/B.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons/Student.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons/Test01.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons/TestStudent.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons01/Student.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons01/TestStudent.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons02/Father.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons02/Son.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons02/TestFather.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/cons02/TestSon.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex01/Person.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex01/TestPerson.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex02/A.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex02/B.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex02/Test01.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Base.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Father.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Person.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Son.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Sub.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Teacher.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Test1.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/Test2.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/ex04/Other.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/ex03/ex04/TestOther.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/AAA.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/BBB.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian01/TestGuanJianZi.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Father.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Son.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian02/Test.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Daughter.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Father.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Son.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian03/Test01.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/A.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/B.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian04/TestFinal.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian05/Person.class


BIN
JavaSE/out/production/day10/com/lovecoding/day10/guanjian05/TestPerson.class