public  class  Interface1  { public  static  void  main ( String [ ]  args)  { System . out. println ( new  DomesticationCat ( ) . compute ( 2 ,  3 ) ) ; ProgrammingInterfaceType  programmingInterfaceType =  new  ProgrammingInterfaceType ( ) ; new  DomesticationCat ( ) . programming ( programmingInterfaceType) ; } 
} interface  USB  { public  void  use3 ( String  type) ; 
} class  Agreement  { } class  Computer  implements  USB  { public  void  watchMovie ( )  { System . out. println ( "电脑可以看电影" ) ; } public  void  input ( )  { System . out. println ( "电脑可以使用自带的键盘触摸板来接受信息" ) ; } @Override public  void  use3 ( String  type)  { if  ( type. equals ( "鼠标" ) )  { System . out. println ( "开始调用鼠标的功能,可以进行输入设备的移动数据" ) ; }  else  if  ( type. equals ( "键盘" ) )  { System . out. println ( "开始调用键盘的功能,可以进行输入设备的指令数据" ) ; }  else  if  ( type. equals ( "硬盘" ) )  { System . out. println ( "开始调用硬盘的功能,可以进行读取数据" ) ; }  else  { System . out. println ( "设备识别错误...无法调用" ) ; } } 
} class  Equipment  implements  USB  { @Override public  void  use3 ( String  type)  { if  ( type. equals ( "天线" ) )  { System . out. println ( "可以接收雷达信号" ) ; }  else  { System . out. println ( "识别错误,无法调用.." ) ; } } 
} interface  Domestication  { public  String  compute ( int  x,  int  y) ; 
} interface  Apotheosis { public  void  programming ( InterfaceType  interfaceType) ; 
} class  Cat  { public  void  eat ( )  { System . out. println ( "🐱会吃猫粮" ) ; } 
} class  DomesticationCat  extends  Cat  implements  Domestication , Apotheosis  { @Override public  String  compute ( int  x,  int  y)  { String  res =  "" ; for  ( int  i =  0 ;  i <  x +  y;  i++ )  { res +=  "喵" ; } return  res; } @Override public  void  programming ( InterfaceType  interfaceType)  { 
boolean  res =  interfaceType. programmingType ( "Java" ) ; if  ( res) { System . out. println ( "🐱可以完成Java编程任务" ) ; } else  { System . out. println ( "接口连接失败,需要再次尝试..." ) ; } } 
} interface  InterfaceType { public  boolean  programmingType ( String  language) ; 
} 
class  ProgrammingInterfaceType  implements  InterfaceType { @Override public  boolean  programmingType ( String  language)  { if  ( language. equals ( "Java" ) ) { System . out. println ( "看来您想使用Java这项神迹,现在赋予给你..." ) ; System . out. println ( "..." ) ; System . out. println ( "你会了" ) ; return  true ; } else  { System . out. println ( "现在该脑机接口只会Java,其他的请使用其他脑机接口" ) ; System . out. println ( "..." ) ; return  false ; } } 
} 
public  class  Interface2  { public  static  void  main ( String [ ]  args)  { new  C ( ) . function1 ( "A" ) ; new  F ( ) . function2 ( "B" ) ; B  b =  new  F ( ) ;   b. function2 ( "B" ) ; System . out. println ( b. VALUE ) ; 
} 
} interface  A  { public  void  function1 ( String  str)  ; 
} 
interface  D  { public  void  function1 ( String  str)  ; 
} interface  B  extends  A , D  { final  static  int  VALUE  =  10 ; public  void  function2 ( String  str)  ; 
} class  C  implements  B  { @Override public  void  function1 ( String  str)  { System . out. println ( "C类实现了A接口中方法" ) ; } @Override public  void  function2 ( String  str)  { System . out. println ( "C类实现了B接口中的方法" ) ; } 
} abstract  class  E  implements  B  { @Override public  void  function2 ( String  str)  { System . out. println ( "抽象类E实现了B接口中的方法" ) ; } 
} class  F  extends  E { @Override public  void  function1 ( String  str)  { System . out. println ( "F实现了A中的抽象方法..." ) ; } 
} class  Person { } abstract  class  Teacher  extends  Person { } 
class  Demo06Util  { public  static  void  main ( String [ ]  args)  { 
Util  util1 =  Util . getObject ( "参数1" ) ; Util  util2 =  Util . getObject ( "参数2" ) ; System . out. println ( util2) ; System . out. println ( util1) ; } 
} 
class  Util  { String  parameter; static  Util  utilObject;   private  Util ( String  parameter)  { } static  { createObject ( "初始化参数" ) ; } private  static  void  createObject ( String  parameter) { utilObject =  new  Util ( parameter) ; } public  static  Util  getObject ( String  parameter) { utilObject. parameter =  parameter; return  utilObject; } } package  com. shujia. day06 ; public  class  Demo07InnerClass  { static  class  InnerClass3  { public  void  innerFunction ( )  { System . out. println ( "这是静态内部类中的一个成员方法" ) ; } } public  static  void  main ( String [ ]  args)  { OuterClass. InnerClass1  innerClass1 =  new  OuterClass ( ) . new  InnerClass1 ( ) ; innerClass1. innerFunction ( ) ; OuterClass. InnerClass2  innerClass2 =  new  OuterClass. InnerClass2 ( ) ; InnerClass3  innerClass3 =  new  InnerClass3 ( ) ; OuterClass . useInnerClassFun ( ) ; OuterInterface  outerInterface =  new  OuterInterface ( )  { @Override public  void  innerFunction ( )  { System . out. println ( "这是接口的匿名内部类所实现的方法" ) ; } } ; outerInterface. innerFunction ( ) ; new  OuterAbstractClass ( )  { @Override public  void  innerFunction ( )  { System . out. println ( "这是抽象类的匿名内部类所实现的方法" ) ; } } . innerFunction ( ) ; } class  OuterClass  { class  InnerClass1  { public  void  innerFunction ( )  { System . out. println ( "这是成员内部类中的一个成员方法" ) ; } } static  class  InnerClass2  { public  void  innerFunction ( )  { System . out. println ( "这是静态内部类中的一个成员方法" ) ; } } public  static  void  useInnerClassFun ( )  { int  i =  10 ;  class  InnerClass4  { public  void  innerFunction ( )  { System . out. println ( "这是局部内部类中的一个成员方法" ) ; } } new  InnerClass4 ( ) . innerFunction ( ) ; } } 
interface  OuterInterface { public  void  innerFunction ( )  ; 
} abstract  class  OuterAbstractClass { public  abstract  void  innerFunction ( )  ; 
} 
import  java. util.  Scanner ; public  class  ObjectClass  { public  static  void  main ( String [ ]  args)  { Object  object1 =  new  Object ( ) ; Obj  obj1 =  new  Obj ( ) ; Object  object2 =  new  Object ( ) ; Object  object3 =  object1; System . out. println ( object1. equals ( object3) ) ;  System . out. println ( object1. equals ( object2) ) ;  Obj  obj2 =  new  Obj ( ) ; Obj  obj3 =  obj1; System . out. println ( obj1. equals ( obj3) ) ;  System . out. println ( obj1. equals ( obj2) ) ;  String  str =  "1" ; Scanner  scanner =  new  Scanner ( System . in) ; System . out. println ( "请输入一个字符串" ) ; String  inputStr =  scanner. next ( ) ; if  ( str ==  inputStr) { System . out. println ( "通过 == 判断 输入的1和定义的1相等" ) ; } else  if  ( str. equals ( inputStr) ) {  System . out. println ( "通过 equals 判断 输入的1和定义的1相等" ) ; } else  { System . out. println ( "不相等" ) ; } System . out. println ( obj3 instanceof  Obj ) ;  Per  per1 =  new  Per ( "001" ) ; Per  per2 =  new  Per ( "001" ) ; System . out. println ( "比较结果:" + per1. equals ( per2) ) ; Obj  obj =  new  Obj ( ) ; System . out. println ( "比较结果:" + per1. equals ( obj) ) ; System . out. println ( "hash值:" + obj. hashCode ( ) ) ;  } 
} class  Obj { } class  Per { String  id; public  Per ( String  id)  { this . id =  id; } @Override public  boolean  equals ( Object  obj)  { if  ( obj instanceof  Per ) { Per  otherPer =  ( Per )  obj; return  this . id. equals ( otherPer. id) ; } else  { return  false ; } } 
}