JAVA 题库 :格林模拟试题二 ( 上 )(2)
JAVA 题库 :格林模拟试题二 (上)(2)JAVA 题库 :格林模拟试题二
( 上 )(2)question 4)what will happen when you attempt to compile and run this code?
class base{
abstract public void myfunc();
public void another(){
("another method");
}
}
public class abs extends base{
public static void main(string argv[]){
abs a = new abs();
();
}
public void myfunc(){
("my func");
}
1
public void amethod(){
myfunc();
}
}
the code will compile and run, printing out the words "my func"
the compiler will complain that the base class is not declared as abstract.
the code will compile but complain at run time that the
base class has non abstract methods
the compiler will complain that the method myfunc in the base class has no body, nobody at all to looove it
question 5)why might you define a method as native?
1) to get to access hardware that java does not know about
to define a new data type such as an unsigned integer
to write optimised code for performance in a language such as c/c++
to overcome the limitation of the private scope of a
method
2
question 6)what will happen when you attem
JAVA题库格林模拟试题二(上) 来自淘豆网m.daumloan.com转载请标明出处.