窗口默认被系统添加到显示器屏幕上,因此不允许将一个窗口添加到其他容器中。
查看答案
使用GridLayout布局的容器中的单元格大小相同。
A. 对
B. 错
中国人与美国人程序模板 请按模板要求,将【代码】替换为Java程序代码。注意填写的程序语句,以分号结尾的一律改为逗号,否则不得分。这是超星系统平台的设置,所以提醒同学们注意!!!!People.javapublic class People {protected double weight,height;public void speakHello() {System.out.println("yayayaya");}public void averageHeight() {height=173;System.out.println("average height:"+height);}public void averageWeight() {weight=70;System.out.println("average weight:"+weight);}}ChinaPeople.javapublic class ChinaPeople extends People {public void speakHello() {System.out.println("您好");}public void averageHeight() {height = 168.78;System.out.println("中国人的平均身高:"+height+" 厘米");}【代码1】 //重写public void averageWeight()方法,输出:"中国人的平均体重:65公斤"public void chinaGongfu() {System.out.println("坐如钟,站如松,睡如弓");}}AmericanPeople.javapublic class AmericanPeople extends People {【代码2】 //重写public void speakHello()方法,输出"How do you do"【代码3】 //重写public void averageHeight()方法,输出"American's average height:176 cm"public void averageWeight() {weight = 75;System.out.println("American's average weight:"+weight+" kg");}public void americanBoxing() {System.out.println("直拳、钩拳、组合拳");}}BeijingPeople.javapublic class BeijingPeople extends ChinaPeople {【代码4】 //重写public void averageHeight()方法, 输出:"北京人的平均身高:172.5厘米"【代码5】 //重写public void averageWeight()方法,输出:"北京人的平均体重:70公斤"public void beijingOpera() {System.out.println("花脸、青衣、花旦和老生");}}Example.javapublic class Example {public static void main(String args[]) {ChinaPeople chinaPeople=new ChinaPeople();AmericanPeople americanPeople=new AmericanPeople();BeijingPeople beijingPeople=new BeijingPeople();chinaPeople.speakHello();americanPeople.speakHello();beijingPeople.speakHello();chinaPeople.averageHeight();americanPeople.averageHeight();beijingPeople.averageHeight();chinaPeople.averageWeight();americanPeople.averageWeight();beijingPeople.averageWeight();chinaPeople.chinaGongfu();americanPeople.americanBoxing();beijingPeople.beijingOpera() ;beijingPeople.chinaGongfu();}}
歌手大赛程序模板 请按模板要求,将【代码】替换为Java程序代码。最后一空请填写本题的运行结果。注意填写的程序语句,以分号结尾的一律改为逗号,否则不得分。这是超星系统平台的设置,所以提醒同学们注意!!!!CompurerAverage.javapublic interface CompurerAverage {//接口public double average(double x[]);}SongGame.javapublic class SongGame implements CompurerAverage {public double average(double x[]) {int count=x.length;double aver=0,temp=0;for(int i=0;i2)aver=aver/(count-2);elseaver=0;return aver;}}School.javapublic class School implements CompurerAverage {//要求用增强的for语句获取每个元素并存放于局部变量xi中,平均值存放于局部变量avre中【代码1】//重写public double average(double x[])方法,返回数组x[]的元素的算术平均}Estimator.javapublic class Estimator{//主类public static void main(String args[]) {double a[] = {9.89,9.88,9.99,9.12,9.69,9.76,9.27};double b[] ={56,55.5,65,50,51.5,53.6,70,49,66,62,46};CompurerAverage computer;computer=new SongGame();double result=【代码2】 //computer调用average(double x[])方法,将数组a传递给参数xSystem.out.printf("%n");System.out.printf("歌手最后得分:%5.3f\n",result);computer=new School();result=【代码3】 //computer调用average(double x[])方法,将数组b传递给参数xSystem.out.printf("学生平均体重:%-5.2f kg",result);}}
阅读程序题(给出【代码】注释标注的代码的输出结果)class A {int f(int x,int y) { return x + y;}}class B extends A {int f(int x, int y) {int m = super.f(x,y) + 10;return m;}}public class习题5_阅读1 {public static void main(String args[ ]) {A a = new B();System.out.println(a.f(2,10)); //【代码】}}