void waitForSignal() { Object obj = new Object(); synchronized (Thread.currentThread()) { obj.wait(); obj.notify(); } } Which is true?()
第1题:
6:写内存拷贝函数 原型给出 void*mymemcpy(void*dest,void*src,int count)
第2题:
下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?
①void GetMemory(char * p)
{
p = (char * )malloc(100);
}
void TestMemory (void)
{
char *str = NULL;
GetMemory (str);
strcpy(str, "hello world");
prinff(str);
}
② char * GetMemory (void)
{
char p[ ] = "hello world";
return p;
}
void TestMemory (void)
{
char * str = NULL;
str = GetMemory( );
printf(str);
}
③void GetMemory(char * * p, int num)
{
* p = (char * )malloc(num);
}
void TestMemory (void)
{
char * str = NULL;
GetMemory(&str, 100);
strcpy( str, "hello" );
printf(sir);
}
④void TestMemory (void)
{
char *str = (char * )malloe(100);
strepy (str, "hello" );
free ( str );
if(str ! = NULL)
{
strepy( str, "world" );
printf(str);
}
}
第3题:
下面正确的函数定义是( )。
A.Fun()
B.void fun
C.void fun()
D.void fun(){}
第4题:
interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
第5题:
哪二种声明防止方法覆盖?()
第6题:
作为类中新线程的开始点,线程的执行是从()方法开始的。
第7题:
Which method must be defined by a class implementing the java.lang.Runnable interface? ()
第8题:
void run()
public void run()
public void start()
void run(int priority)
public void run(int priority)
public void start(int priority)
第9题:
This code may throw an InterruptedException.
This code may throw an IllegalStateException.
This code may throw a TimeoutException after ten minutes.
This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.
Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.
A call to notify() or notifyAll() from another thread may cause this method to complete normally.
第10题:
protected void m(){}
final void m(){}
abstractfinal void m (){}
staticfinal void m(){}
第11题:
new Thread() { public void run() { doStuff(); } }
new Thread() { public void start() { doStuff(); } }
new Thread() { public void start() { doStuff(); } } .run();
new Thread() { public void run() { doStuff(); } } .start();
new Thread(new Runnable() { public void run() { doStuff(); } } ).run();
new Thread(new Runnable() { public void run() { doStuff(); } }).start();
第12题:
public void m1() { }
protected void m1() { }
private void m1() { }
void m2() { }
public void m2() { }
protected void m2() { }
第13题:
请写出下面的输出:
class B
{
public:
virtual void Print(void)
{
printf(“B::Print\n”);
}
virtual void Reprint(void)
{
printf(“B:Reprint\n”);
}
void Algo(void)
{
Print();
Reprint();
}
};
class D : public B
{
public:
virtual void Print(void)
{
printf(“D::Print\n”);
}
};
void main()
{
B *p = new D();
p->Print();
p->Algo();
}
第14题:
下面的说明中,正确的函数定义是( )。
A.void fun(void)
B.void fun(void){}
C.fun(int s){}
D.fun(int s){return s+1;}
第15题:
下列方法定义中,()是抽象方法。
第16题:
Which two declarations prevent the overriding of a method? ()
第17题:
可以限制一个方法重载的声明语句有()。
第18题:
下面那一个函数是线程的入口函数? ()
第19题:
下面哪些方法禁止子类重定义该方法()
第20题:
public class Employee extends Info implements Data { public void load() { /*do something*/ } }
public class Employee implements Info extends Data { public void load() { /*do something*/ } }
public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
第21题:
new Thread() {public void run() { doStuff(); }};
new Thread() {public void start() { doStuff(); }};
new Thread() {public void start() { doStuff(); }}.run();
new Thread() {public void run() { doStuff(); }}.start();
new Thread(new Runnable() {public void run() { doStuff(); }}).start();
第22题:
final void methoda() {}
void final methoda() {}
static void methoda() {}
static final void methoda() {}
final abstract void methoda() {}
第23题:
final void methoda(){}
void final methoda(){}
static final void methoda(){}
static void methoda(){}
final abstract void methoda(){}