A.“int *p=new int (10);”
B.“int *p=new int [10];”
C.“int *p=new int ;”
D.“int *p=new int (10)(0);”
下列语句中错误的是( )。
A.int a[][]=new int[2][];
B.int a[][]=new int[][];
C.int a[][]=new int[2][3];
D.int[][] a=new int[3][2];
下列数组定义及赋值,错误的是( )。
A.int a[]={1,2,3,4,5};
B.int intArray[];
C.int Array=new int[3]; int Array[1]=1; int Array[2]=2; int Array[3]=3;
D.int a[][]=new int[2][]; a[0]=new int[3]; a[1]=new int[3];
如下两个源程序文件,分别编译后,运行Example.class文件,运行结果为______。
AB.java文件代码如下;
package test;
public class AB
{
int a=60;
public void show()
{
System.out.println(”a=”+a);
}
Example.java文件代码如下:
import test.AB;
class Example
{
public static void main(String args[])
{
AB bj=new AB();
obj.show();
}
}
A.Foo { public int bar() { return 1; }
B.new Foo { public int bar() { return 1; }
C.new Foo() { public int bar() { return 1; }
D.new class Foo { public int bar() { return 1; }
下列哪个类是RuntimeException类的子类( )A.ArrayIndexOutOfBoundsException B.ErrorC.Throwable; D.Exception
有内部类定义如下:public class OutApublic class InnerB则在其它类中,创建内部类InnerB对象的语句是( )A.InnerB ab=new InnerB();B.OutA.InnerB ab=new OutA.InnerB();C.OutA.InnerB ab=new OutA().new InnerB();D.InnerB ab=new OutA.InnerB();
在类中定义有两个方法class MyClassdouble addTwoData(int a,int b)return a+b;int addTwoData(int a,int b)return a+b;下列说法正确的是( )A.addTwoData()方法重载B.编译错误C.addTwoData()方法改写D.以上说法都不正确( )
下列哪个类能为每个使用该变量的线程提供独立的变量副本( )A.Thread B. ThreadFactory C.ThreadInfo D.ThreadLocal
从字符串JAVA中获取子目V所在的位置(位置结果是2),你选择用哪个方法 ( )A.indexOf(s,v); B.charAt(2); C.s.indexOf(v); D. mid(2,s);
下列运算符合法的?(A )A.& B.:= C.if D. 7、B/S架构的B最确切的是指什么 ( )A.和服务端一同提供配套的客户端软件 B.基础软件环境C.网页浏览器 D. Firefox软件
RCP中都是使用下列哪项技术来扩展功能的,比如菜单、透视图、编辑器等。( )A 插件 B.扩展点 C.工作台 D.工作区
下列正确的是:( B )A.Java程序经编译后会产生DLLB.Java程序经编译后会产生byte codeC.Java程序经编译后会产生machine codeD.以上都不正确
以下哪个不是Collection的子接口?( )A.List B.SortedSet C.Set D.Map11、JSP中,不可以在多个页面中一直保持数据的对象是 ( )A.request B.cookie C.application D.session
下面语句请选择正确的输出( )System.out.println(4 | 3);A. 1 B.0 C. 6 D.7
、编译运行如下代码,输出是( )public class myprogpublic static void main(String argv)System.out.println(argv2) ;A.null B. myprog C.0D.Exception raised: java.lang.ArrayIndexOutOfBoundsException: 2
编译运行如下代码,将会( )public class MyClasspublic static void main(String argv)MyClass h = new MyClass ();protected MyClass ()for(int i =0; i 10; i +)System.out.println(i);A.输出0到10B.Run time error: Constructors cannot be declared protectedC.Compilation error: Constructors cannot be declared protectedD.输出0到9
下列哪个会告诉jvm执行垃圾回收 ( )A.System.free(); B. System.out.gc();C.System.gc(); D.System.setGarbageCollection();
下列哪个类的声明是正确的? ( )A.abstract private move() B. abstract final class HIC.protected private number; D.public abstract class Car
使用VC6打开考生文件夹下的工程test15_3。此工程包含一个test15_3.cpp,其中定义了类Time和Timex,Timex公有继承Time,但定义并不完整。请按要求完成下列操作,将程序补充完整。
(1)完成类Time构造函数的定义,将数据成员hours和minutes分别初始化为参数new_hours和new_minutes的值。请在注释“//**1**”之后添加适当的语句。
(2)完成类Timex的构造函数的定义,注意参数的传递。请在注释“//**2**”之后添加适当的语句。
(3)请按时间格式“hour:minute”和“hour:minute:second”分别输出对象time1和time2所表示的时间,注意必须使用已经定义的成员函数。请在注释“//**3**”之后添加适当的语句。
输出结果如下:
20:30
10:45:34
注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。
源程序文件test15_3.cpp清单如下:
include<iostream.h>
class Time
{
public:
Time(int new hours,int new_minutes)
{
// ** 1 **
}
int get_hours();
int get_minutes();
protected:
int hours,minutes;
};
int Time::get_hours()
{
return hours;
}
int Time::get_minutes()
{
return minutes;
}
class Timex:public Time
{
public:
Timex(int new hours,int new_minutes,int new_seconds);
int get_seconds();
protected:
int seconds;
};
// ** 2 **
{
seconds=new_seconds;
}
int Timex::get_seconds()
{
return seconds;
}
void main()
{
Time time1(20,30);
Timex time2(10,45,34);
// ** 3 **
}
本题定义了一个求两个数的最大值的方法max,并调用该方法计算67和23的最大值。 public class javal{ public static void main(String[]args){ javal temp=new javal; int res=max(67,23); System.out.println("res="+res); } static int maX( ){ int maxNum; if(a>b) ; else maxNum=b; ; } }
设A为已定义的类名,则下列声明A类的对象a的语句中正确的是( )。
A.public A a=new A
B.public A a=A
C.A a=new class;
D.a A;
设有类定义如下:
class Base{
public Base(int i){}
}
public class MyOver extends Base{
public static void main(String arg[]){
MyOver m = new MyOver(10);
}
MyOver(int i){
super(i);
}
MyOver(String s, int i){
this(i);
//Here
}
}
以下哪条语句可以安排在//Here处 ?
A.MyOver m = new MyOver();
B.super();
C.this("Hello",10);
D.Base b = new Base(10);
假定AB为一个类,则执行“AB *p=new AB(1,2);”语句时共调用该类构造函数的次数为()
1. class SuperFoo { 2. SuperFoo doStuff(int x) { 3. return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 下面哪三项分别插入到第8行,可以编译?()
以下的数组定义语句中,不正确的是()
假定AB为一个类,则执行 “AB *s=new AB(a,5);”语句时得到的一个动态对象为()
int[] a=new int[5]{1,2,3,4,5};
int[,] a=new int[3][4];
int[][] a=new int[3][];
int[] a={1,2,3,4,5};
假定AB为一个类,则执行 “AB *px=new AB[n];”语句时调用该类无参构造函数的次数为()
现有: 1.class SuperFoo{ 2.SuperFoo doStuff (int x) { 3.return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 和四个声明: Foo doStuff (int x) { return new Foo(); } Foo doStuff (int x) { return new SuperFoo(); } SuperFoo doStuff(int x) { return new Foo(); } SuperFoo doStuff(int y) { return new SuperFoo(); } 分别插入到第8行,有几个可以通过编泽?()
以下建立动态存储的语句正确的是()
int a[ ][ ] = new int[][];
int a[10][10] = new int[][];
int a[ ][ ] = new int[10][10];
int [ ][ ]a = new int[10][10];
int [ ]a[ ] = new int[10][10];
下列的数组定义语句,不正确的是()。
int p=new int[];
int p=new [10];
int *p=new int[10];
int *p[10]=new int;