【JAVA】来自Java编程题的疑问

1.System.out.println((int)(char)(byte) -1); 结果是?
https://blog.csdn.net/pmcasp/article/details/80746598
-1不在表范围之内,怎么看啊?涉及到-1是补码,可以去看看基础书。

2.第二个代码块的7&11行表示实例化第一个代码块,可经过验证,此两行有无都不影响结果输出,为何?
可能是第二个代码块的11行起了作用?

package com.ok;

public class course {
	public String id;
	public String name;
	public course(String id,String name){
		this.id=id;
		this.name=name;
	}
}

package com.ok;

import java.util.ArrayList;
import java.util.List;

public class ListTest {
//	public List course;
	public List courseToSelect;
	public ListTest(){
//		this.course=new ArrayList();
		this.courseToSelect=new ArrayList();
	}
	public void addTest(){
		course cr1=new course("1","英语");
		courseToSelect.add(cr1);
		course temp=(course)courseToSelect.get(0);
		System.out.println("添加了一门:"+temp.id+":"+temp.name);
	}
	
	
	
	public static void main(String[] args) {
		ListTest it=new ListTest();
		it.addTest();
	}

}

3.Type mismatch: cannot convert from element type Object to Document
可能是引用类“Document”没有规定泛型。

4.什么是线程安全和线程不安全?什么是JVM

转载于:https://www.cnblogs.com/helloworld201810/p/9783165.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值