格林模拟试题二(上)(2)
question 4)
what will happen when you attempt to compile and run this code?
class base{public void another(){
}
public class abs extends base{
abs a = new abs();
}
public void myfunc(){
}
public void amethod(){
}
1) the code will compile and run, printing out the words "my func"
3) the code will compile but complain at run time that the base class has non abstract methods
question 5)
why might you define a method as native?
1) to get to access hardware that java does not know about
3) to write optimised code for performance in a language such as c/c++
question 6)
what will happen when you attempt to compile and run this code?
class base{system.out.println("amethod");
}
public class fin extends base{
base b = new base();
}
1) compile time error indicating that a class with any final methods must be declared final itself
3) run time error indicating that base is not defined as final
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>