AccessViolationException异常触发后,下列程序的输出结果为( )
static void Main(string[] args) { try { throw new AccessViolationException(); Console.WriteLine("error1"); } catch (Exception e) { Console.WriteLine("error2"); } Console.WriteLine("error3"); }解析:
1.catch(){}块中,如果有throw 语句,则,try{}catch(){} finally{}块之外的代码不执行;否则,执行。
2.try{}中有异常,则异常下面代码不执行。 3.finally{}中代码必执行。
如果一个list初始化为{5,3,1},执行以下代码后,其结果为()? nums.add(6); nums.add(0,4); nums.remove(1);解析:
解析如下:
nums.add(6);//把6添加到list末尾,变为{5,3,1,6} nums.add(0,4);//在list的第0个位置添加4,list变为{4,5,3,1,6} nums.remove(1);//移除list的第一个元素,list变为{4,3,1,6}
一般有两种用于创建线程的方法,一是(),二是()。
解析:
创建线程对象两种方式:
1.继承Thread类,重载run方法;
2.实现Runnable接口,实现run方法
以下可以正确获取结果集的有
解析:
A,D是正确的;创建Statement是不传参的,PreparedStatement是需要传入sql语句
