更多"Object类中的方法public int hashCode( ),在"的相关试题:
[单项选择]Object类中的方法public int hashCode( ),在其子类覆盖该方法时,其方法修饰符可以是
A. protected
B. public
C. private
D. 缺省
[单项选择]若给下面的方法传入参数67时,输出结果为( )。
public int MaskOff(int N)
return N^3;
A. 3
B. 64
C. 67
D. 0
[单项选择]执行下列方法method( ),返回值为( )。
public int method
int num=6;
if (num>8) return num;
num=7;
A. 编译出错
B. 6
C. 7
D. 8
[单项选择]如果创建的子类覆盖了父类的一个public方法,则对该方法可以使用( )修饰符。
A. public
B. public和protected
C. private
D. 任意修饰符都可以,由系统随机选取
[单项选择]有如下类定义:
class AA
int a;
public :
int getRef( )const t return &a; //①
int getValue( )const return a; //②
void set(int n)const a=n; //③
friend void show(AA aa)const cout <<a; //④
;
其中四个函数的定义中正确的是( )。
A. ①
B. ②
C. ③
D. ④
[单项选择]有如下类定义:
class AA
int a;
public:
int getRef( )constreturn &a; //①
int getValue( )constreturn a;) //②
void set(int n)consta=n; //③
friend void show(AAaa)constcout<<a; //④
;
其中的四个函数定义中正确的是
A. ①
B. ②
C. ③
D. ④
[单项选择]有如下类定义: class AA { int a; public: int getRef( )const{return &a;} //① int getValue( )const{return a;) //② void set(int n)const{a=n;} //③ friend void show(AAaa)const{cout<<a;} //④ }; 其中的四个函数定义中正确的是
A. ①
B. ②
C. ③
D. ④
[单项选择]有如下类定义:
class AA
int a;
public:
int getRef( )const return &a; //①
int getValue( )const( return a; //②
void set(int n)consta=n; //③
friend void show(AA aa)const cout<<a;//④
;
其中的四个函数定义中正确的是( )。
A. ①
B. ②
C. ③
D. ④
[单项选择]有以下程序:
Class Date
public:
Date(int y,int m,int d);
year=y;
month=m;
day=d;
Date(int y=2000)
year=y;
month=10;
day=1;)
Date(Date &d)
year=d.year;
month=d.month;
day=d.day;
void print( )
cout<<year<<“.”<<month<<“.”<<day<<endl;
private:
int year,month,day;;
Date fun(Date d)
Datetemp;
temp=d;
return temp;
int main( )
Date date1(2000,1,1),date2(0,0,0);
Date date3(datel);
date2=fun(date3);
return 0;
程序执行时,Date类的拷贝构造函数被调用的次数是( )。
A. 2
B. 3
C. 4
D. 5
[单项选择]设有定义:
class C
public:
int ValUe;
;
int X,*p;
则以下引用形式中,正确的是( )。
A. x=value;
B. x=C://:value;
C. p=&value
D. p=C://:value
[填空题]子类的对象拥有其超类的对象的全部属性和方法,称为子类对超类的()。
[填空题]子类的对象拥有其超类的对象的全部属性和方法,称为子类对超类的 【19】 。
[单项选择]阅读下列代码后
public class Person
int art[]=new int[10];
public static void main(String args[])
System.out.println(arr[1]);
正确的说法是( )。
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出零
D. 输出空
[单项选择]若类A和类B的定义如下:
class A
int i,j;
public:
int geti( )
return i;
;
class B:public A
int k;
public:
void make( )
k=i*j;
;
则上述定义中非法的表达式是( )。
A. k=i*j
B. int k;
C. return i;
D. void make()
[填空题]子类的对象拥有其超类的对象的全部属性的方法,称为子类对超类的______。
[单项选择]阅读下列代码后
public class Person
int arr[]=new int[10];
public static void main(String args[])
System.out.println(arr[1]);
正确的说法是______。
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出零
D. 输出空