接口1编写一个java程序,在程序中定义一个借口shape,定义一个类cylinder实现借口shape,在cylinder类中实现shape接口中的抽象方法。importjava.text.DecimalFormat;interfaceShape{finalfloatpi=3.14f;abstractdoublearea();abstractdoublevolume();}classCylinderimplementsShape{privatedoubleradius;privateintheight;publicCylinder(doubler,inth){radius=r;height=h;}publicdoublearea(){return(pi*radius*radius);}publicdoublevolume(){returnpi*radius*radius*height;}}classMyInterface{publicstaticvoidmain(String[]args){Cylindera=newCylinder(2,3);DecimalFormatmyFormat=newDecimalFormat(0.00);System.out.println(圆柱体的面积是+myFormat.format(a.area()));System.out.println(“圆柱体的面积是+myFormat.format(a.volume()));}}运行结果:圆柱体的面积是12.56圆柱体的面积是37.68Processcompleted.接口2编写一个java程序,在程序中定义一个接口Achievement,定义一个父类person,定义一个子类student继承Achievement接口,在子类student中实现接口中的抽象方法并调用父类的方法。interfaceAchievement{abstractfloataverage();}classPerson{Stringname;intage;publicPerson(StringnewName,intnewAge){name=newName;age=newAge;}publicvoidintroduce(){System.out.println(你好,我是+name+,今年+age+岁);}}classStudentextendsPersonimplementsAchievement{intChinese;intMath;intEnglish;publicStudent(StringnewName,intnewAge){super(newName,newAge);}publicvoidsetScore(intc,intm,inte){Chinese=c;Math=m;English=e;}publicfloataverage(){return(Chinese+Math+English)/3;}}classJiekou{publicstaticvoidmain(String[]args){Students1=newStudent(张三,16);s1.introduce();s1.setScore(80,90,80);System.out.println(平均分:+s1.average());}}运行结果:你好,我是张三,今年16岁平均分:83.0Processcompleted.