更多"对于下面程序,对p调用正确的是( )。 class A{ pub"的相关试题:
[单项选择]对于下面程序,对p调用正确的是( )。
class A
public:fun(int i)cout<<i<<endl;
;
main( )
A a;
int k=0;
void(A::*p)(int);
p=A::fun;
A. p(k);
B. *a.p(k)
C. *p(k)
D. a::*p(k)
[单项选择]对于下面程序,对p进行赋值正确的是( )。 class A{ public:fun(int i){cout<<i<<endl;} }; main( ){ void(A::*p)(int); }
A. p=fun;
B. p=fun();
C. p=A::fun;
D. p=A::fun()
[单项选择]阅读下面的程序:
public class Person
int arr[ ]=Hew int[10];
public static void main(String args[ ])
System.out.println(arr[1]);
正确的说法是______。
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出为0
D. 输出为空
[单项选择]下面程序执行后的输出结果为( )。 public class fun { public static void main(String args[]) { String greets = " How are you!"; String s = greets.substring(0,3); System.out.println(s); } }
A. How
B. are
C. you
D. how are you!
[单项选择]有下列程序段
public class fun
public static void main(String args[])
char b[] = "Hello,you";
b[5] = 0;
System.out.println(s);
执行此程序后,得到的输出结果是( )。
A. Hello,you
B. Hello0you
C. Hello
D. 0
[单项选择]有下列程序段
public class fun
public static void main(String args[])
char b[]="Hello,you";
b[5] = 0;
System.out.println(s);
执行此程序后,得到的输出结果是( )。
A. Hello, you
B. Hello0you
C. Hello
D. 0
[单项选择]有下列程序段 public class fun { public static void main(String args[]) { char b[]="Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是( )。
A. Hello, you
B. Hello0you
C. Hello
D. 0
[单项选择]有如下类定义: class Fun { public: Fun(int v):value(v){}//① ~Fun( ){}//② private: Fun{},//③ int value=0;//④ }; 其中存在语法错误的行是( )。
A. ①
B. ②
C. ③
D. ④
[单项选择]有下列程序段 public class fun { public static void main(String args[]) { char b[] = "Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是( )。
A. Hello,you
B. Hello0you
C. Hello
D. 0
[单项选择]阅读下面的程序: public class Person{ int arr[ ]=Hew int[10]; public static void main(String args[ ]){ System.out.println(arr[1]); } } 正确的说法是______。
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出为0
D. 输出为空
[单项选择]给出下列的程序,其叙述正确的是( )。
public class Man
static int arr[]=new int[10];
public static void main(String args[])
System. out. println (arr[1=];
A. 编译时将发生错误
B. 编译时正确但是运行时出错
C. 输出为0
D. 输出为null
[单项选择]阅读下列代码后
public class Person
int arr[]=new int[10];
public static void main(String args[])
System.out.println(arr[1]);
正确的说法是( )。
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出零
D. 输出空
[单项选择]有如下程序段: public class Parent { public int addValue (int a,int b) { int s; s=a+b; return 3; } } class Child extends Parent {} 则下列选项中,可以正确加入类Child中且父类的方法不会被覆盖的是( )。
A. int addValue (int a,int {//do somethin..}
B. public void addValue() {//do somethin..}
C. public int addValue (int a,int throws MyException {//do somethin..}
D. public float addValue (int a,int b,float b=1.0) {//do sometin..}
[单项选择]阅读下面程序 public class ConcatTest { public static void main(String[] args) { String str1="abc"; String str2="ABC": String str3=str1.concat(str2); System.out.println(str3); } } 程序运行的结果是
A. abc
B. ABC
C. abcABC
D. ABCabc
[单项选择]下面程序段中的错误语句是 ______。
class M
int i;
public:
void ~AA(int);
AA *p;
void AA( );
void AA(int x)i=x;;
;
A. AA *p;
B. void ~AA(int);
C. void AA(int);
D. void AA(int x)i=x;;
[单项选择]阅读下面程序
public class Cycle
public static void main(String[] args)
System.out.println(args[0]);
在命令行输入java Cycle one two,该程序输出的结果是
A. Cycle
B. one
C. two
D. 以上三个选项都不对
[单项选择]阅读下面程序 public class Cycle { public static void main(String[] args) { System.out.println(args[0]); } } 在命令行输入java Cycle one two,该程序输出的结果是
A. Cycle
B. one
C. two
D. 以上三个选项都不对
[单项选择]阅读下面程序 public class MyVal { public static void main(String[]args) { MyVal m=new MyVal( ); m.amethod( ); } public void amethod( ) { boolean b[]=new Boolean[5]; } } 程序编译或运行的结果是
A. 1
B. null
C. ""
D. 编译不通过