java 将日期转化为格林时间_JAVA题库:格林模拟试题二(下)(1)

JAVA认证试题集锦 2021-07-15 网络整理 可可

【shitiku.jxxyjl.com--JAVA认证试题集锦】

question 31)what will happen when you attempt to compile and run the following code

import java.io.*;
class base{
public void amethod()throws filenotfoundexception{}
}

public class excepdemo extends base{
public static void main(string argv[]){
excepdemo e = new excepdemo();
}

public void amethod(){}
protected excepdemo(){
try{
datainputstream din = new datainputstream(system.in);
system.out.println("pausing");
din.readbyte();
system.out.println("continuing");
this.amethod();
}catch(ioexception ioe) {}

}
}
1) compile time error caused by protected constructor
2) compile time error caused by amethod not declaring exception
3) runtime error caused by amethod not declaring exception
4) compile and run with output of "pausing" and "continuing" after a key is hit

question 32)
what will happen when you attempt to compile and run this program

public class outer{
public string name = "outer";
public static void main(string argv[]){
inner i = new inner();
i.showname();
}//end of main
private class inner{
string name =new string("inner");
void showname(){
system.out.println(name);
}
}//end of inner class
}
1) compile and run with output of "outer"
2) compile and run with output of "inner"
3) compile time error because inner is declared as private
4) compile time error because of the line creating the instance of inner

本文来源:https://shitiku.jxxyjl.com/javarenzhengshitijijin/6374.html

Copyright @ 2011- 考试题库网 All Rights Reserved. 版权所有

免责声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。

 站长统计