更多"已知有下面的类说明: public class Test4 { "的相关试题:
[单项选择]已知有下面的类说明: pubic class Test4 { private float f=1.0f; int m=12; static int n=1; public static void main(String args[]) { Test4 e=new Test4( ); } } 在main( )方法中,下面( )使用是正确的。
A. f
B. thin
C. Test4.m
D. Test4.f
[单项选择]已知有下列类的说明,则下列哪个语句是正确的
public class Test
private float f=1.0f;
int m=12;
static int n=1;
public static void main(String arg[])
Test t= new Test( );
A. f;
B. this. n
C. Test.m;
D. Test.f;
[单项选择]已知有下列类的说明,则下列哪个语句是正确的public class Test { private float f=1.0f; int m=12; static int n=1; public static void main(String arg[]) { Test t= new Test( ); }}
A. f;
B. thi n
C. Tesm;
D. Tesf;
[单项选择]阅读下面程序 public class Test4 { public static void main(String[] args) { int 1=10,j=3; float m=213.5f,n=4.0f; System.out.println(i%j); System.out.println(m%n); } } 程序运行的结果是
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]
阅读下面程序
public class Test4 {
public static Void main(String args[]){
int i=10, j=3;
float m=213.5f, n=4.0f;
System.out.println(i%j);
System.out.println(m%n);
}
}
程序运行的结果是()
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]有如下类定义
class MyClass
public:
Private:
int data;
};
若要为MyClass类重载流输入运算符>>,使得程序中可以“cin>>obj;”形式输入MyClass类的对象obj,则横线处的声明语句应为( )。
A. friend istream& operator>>(istream& is, MyClass& A) ;
B. friend istream& operator>>(istream& is, MyClass A) ;
C. istream& operator>>(istream& is, MyClass& A) ;
D. istream& operator>>(istream& is, MyClass A) ;
[单项选择]
下列代码的执行结果是()。
public class test4{
public static void main(string args[]){
int a=4,b=6,c=8;
String s="abc";
System.out.println(a+b+s+e);
System.out.pfinfin( ); }
}
A. ababcc
B. 464688
C. 46abc8
D. 10abc8
[单项选择]有如下类定义:
class Test
private int x;
public int y;
public void setX (int m) x=m;
public int getX( ) return x;
现用Test t=new Text( );生成一个对象t,则如下语句中,错误的是( )。
A. x=10;
B. y=10;
C. setX(10);
D. int m=t.getX( );
[单项选择]有如下类定义: class Test { private int x; public int y; public void setX (int m) {x=m;} public int getX( ) {return x;} }现用Test t=new Text( );生成一个对象t,则如下语句中,错误的是( )。
A. x=10;
B. y=10;
C. setX(10);
D. int m=getX( );
[单项选择]已知float x[20];,则下面表达式正确的是()。
A. x[20]=x[1]+x[2]
B. x[2]=x[2]+x[3]
C. x[0]=x[-1]+x[1]
D. x[18]=x[20]-x[2]
[单项选择]有如下类定义:
class B{
public: void fun1( ){}
private: void fun2( ){}
protected: void fun3( ){}
};
class D: public B{
protected: void fun4( ){}
};
若obj是类D的对象,则下列语句中不违反访问控制权限的是( )。
A. obj. fun1();
B. obj. fun2();
C. obj. fun3();
D. obj. fun4();
[单项选择]The author's reference to "private and public collections" suggests that ______.
A. (A) museums cannot prevent forgeries from entering their collections
B. (B) museums sometimes seek out forgeries for their collections
C. (C) museums that knowingly purchase forgeries are foolish
D. (D) many valuable paintings have yet to be found in museum storerooms
[单项选择]Would you prefer to stay in a private or public ______ in the hospital
A. cell
B. ward
C. chamber
D. suite
[单项选择]已知有结构体:
struct sk
int a;
float b;
data,*p;
若有p=&data, 则对data的成员a的正确引用是( )。
A. (*p).data.a
B. (*p).a
C. p->data.a
D. data.a
[单项选择]In the United States, both public and private universities depend on the following sources of income except ______.
A. investment
B. student tuition
C. endowments
D. government funding