packagecom.zishi.lesson3;/*
推导Lambdal表达式*/publicclassTestLembdal{//3.内部静态类staticclassLike2implementsILike{@Overridepublicvoidlambda(){System.out.println("i like lambda2");}}publicstaticvoidmain(String[] args){ILike like =newLike();like.lambda();like =newLike2();like.lambda();//4.局部内部类classLike3implementsILike{@Overridepublicvoidlambda(){System.out.println("i like lambda3");}}like =newLike3();like.lambda();//5.匿名内部类:没有类的名称,必须借助接口或者父类实现like =newILike(){@Overridepublicvoidlambda(){System.out.println("i like lambda4");}};like.lambda();//6.用lambda()简化like =()->{System.out.println("i like lambda5");};like.lambda();}}//1.定义一个函数式接口:只有一个抽象类方法interfaceILike{voidlambda();}//2.实现类classLikeimplementsILike{@Overridepublicvoidlambda(){System.out.println("i like lambda");}}
packagecom.zishi.lesson3;publicclassTestLembdal2{publicstaticvoidmain(String[] args){ILove love =null;//1.lambda表示简化// ILove love = (int a)->{// System.out.println("i love -->"+a);// };// //2.简化括号// love = a -> {// System.out.println("i love -->"+a);// };//3.简化:去掉花括号love =(a,b,c)->System.out.println("i love -->"+a+b+c);love.love(520,520,520);//总结:/*lambda表达式只能有一行代码的情况下,才能简化成一行,如果有一行,那么就用代码快包裹前提是接口为函数式接口多个参数也可以去掉参数类型,要去掉就都去掉,必须加上括号*/}}interfaceILove{voidlove(int a,int b,int c);}
class DBDA { public $host"localhost";//服务器地址 public $uid"root";//用户名 public $pwd"";//密码 public $conn;//连接对象 //操作数据库的方法 //$sql代表需要执行的SQL语句 //$type代表SQL语句的类型,1代表查询,…