java格林认证_JAVA题库:格林模拟试题一(下)(8)

这段代码讨论了尝试编译并运行一个Java程序时,如果基类的私有方法被子类调用的情况,以及如何使用GridBagLayout管理按钮位置。选项包括编译错误、运行时错误和输出结果。同时涉及Applet中按钮布局的设置技巧。
摘要由CSDN通过智能技术生成

question 59)

what will happen when you attempt to compile and run the following codeclass base{

private void amethod(int ibase){

system.out.println("base.amethod");

}

}

class over extends base{

public static void main(string argv[]){

over o = new over();

int ibase=0;

o.amethod(ibase);

}

public void amethod(int iover){

system.out.println("over.amethod");

}

}

1) compile time error complaining that base.amethod is private

2) runtime error complaining that base.amethod is private

3) output of "base.amethod"

4) output of "over.amethod"

question 60)

you are creating an applet with a frame that contains buttons. you are using the gridbaglayout manager and you have added four buttons. at the moment the buttons appear in the centre of the frame from left to right. you want them to appear one on top of the other going down the screen. what is the most appropriate way to do this.

1) set the gridy value of the gridbagconstraints class to a value increasing from 1 to 4

2) set the fill value of the gridbagconstraints class to vertical

3) set the ipady value of the gridbagconstraints class to a value increasing from 0 to 4

4) set the fill value of the gridbaglayouts class to gridbag.vertical

来源:考试大-Java认证

责编:yunyun  评论 纠错

2下一页

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值