没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
笔试题及答案
一、选择题(单选,多选)
1, 分析如下代码,最后输出结果为:( B )
class GaoYang {
private String name;
public GaoYang(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static void main(String[] args){
GaoYang gy1 = new GaoYang("高阳");
GaoYang gy2 = new GaoYang("高阳");
System.out.println(gy1.equals(gy2));
}
A) true B) false
2,分析如下代码块:
public class GaoYangTest implements Runnable {
int b = 100;
synchronized void m1() throws InterruptedException {
b = 1000;
Thread.sleep(500);
System.out.println("b=" + b);
}
synchronized void m2() throws InterruptedException {
Thread.sleep(250);
b = 2000;
}
public static void main(String[] args) throws InterruptedException {
GaoYangTest gy = new GaoYangTest();
Thread thread = new Thread(gy);
thread.start();
gy.m2();
System.out.println("main thread b=" +gy.b);
资源评论
蚁库
- 粉丝: 31
- 资源: 99
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功