10. public Object m() { 11. Object o = new Float(3.14F); 12. Object [] oa = new Object[1]; 13. oa[0] = o; 14. o = null; 15. return oa[0]; 16. } When is the Float object, created in line 11, eligible for garbage collection?()
第1题:
A.public class MinMax<?> {
B.public class MinMax<? extends Number> {
C.public class MinMax<N extends Object> {
D.public class MinMax<N extends Number> {
E.public class MinMax<? extends Object> {
F.public class MinMax<N extends Integer> {
第2题:
以下程序的输出结果是_____。
include<iostream.h>
class object
{ private:
int val;
public:
object( ) ;
object(int i) ;
~object( ) ;};
object: :object( )
{ val=0;
cout < < "Default constructor for object" < < endl;}
object: :object(int i)
{ val=i;
cout < < "Constructor for object" < < val < < endl;}
object: :~object( )
{ cout < < "Destructor for object" < < val < < endl;}
class container{ private:
object one;
object two;
int data;
public:
container( ) ;
container(int i,int j,int k) ;
~container( ) ;};
container: :container( )
{ data=0;
cout < < "Default constructor for container" < < endl;}
container: :container(int i,int j,int k) :two(i) ,one(j)
{ data=k;
cout < < "Constructor for container" < < endl;}
container: :~container( )
{ cout < < "Destructor for container" < < endl;}
void main( )
{ container anObj(5,6,10) ;}
第3题:
阅读下列函数说明和Java代码,将应填入(n)处的字句写在对应栏内。
【说明】
类Queue表示队列,类中的方法如下表所示。
类Node表示队列中的元素;类EmptyQueueException给出了队列操作中的异常处理操作。
public class TestMain { //主类
public static viod main (String args[]){
Queue q=new Queue();
q.enqueue("first!");
q.enqueue("second!");
q.enqueue("third!");
(1) {
while(true)
System.out.println(q.dequeue());
}
catch( (2) ){ }
}
public class Queue { //队列
Node m_FirstNode;
public Queue(){m_FirstNode=null;}
public boolean isEmpty(){
if(m_FirstNode==null)return true;
else return false;
}
public viod enqueue(Object newNode) { //入队操作
Node next=m_FirstNode;
if(next==null)m_FirstNode=new Node(newNode);
else{
while(next.getNext()!=null)next=next.getNext();
next.setNext(new node(newNode));
}
}
public Object dequeue() (3) { //出队操作
Object node;
if (isEempty())
(4); //队列为空, 抛出异常
else{
node=m_FirstNode.getObject();
m_FirstNode=m_FirstNode.getNext();
return node;
}
}
}
public class Node{ //队列中的元素
Object m_Data;
Node m_Next;
public Node(Object data) {m_Data=data; m_Next=null;}
public Node(Object data, Node next) {m_Data=data; m_Next=-next;}
public void setObject(Object data) {m_Data=data;}
public Object getObject(Object data) {return m_data;}
public void setNext(Node next) {m_Next=next;}
public Node getNext() {return m_Next;}
}
public class EmptyQueueException extends (5) { //异常处理类
public EmptyQueueException() {
System.out.println("队列已空! ");
}
}
第4题:
在J2EE中,以下是firePropertyChange的原型,正确的是()。
第5题:
public class X { public object m () { object o = new float (3.14F); object oa = new object [1]; oa[0]= o; o = null; return oa[0]; } } When is the float object created in line 3, eligible for garbage collection?()
第6题:
A.public int compareTo(Object o){/*more code here*/}
B.public int compareTo(Score other){/*more code here*/}
C.public int compare(Score s1,Score s2){/*more code here*/}
D.public int compare(Object o1,Object o2){/*more code here*/}
第7题:
把一个对象写到一个流中相对比较简单,具体是通过调用ObjectOutputStream类的writeObject()方法实现的,那么该方法的定义为( )。
A.public final int writeObject(Object obj) throws IOException
B.public final void writeObject(Object obj) throws IOException
C.public Object writeObject(Object obj) throws IOException
D.public final Object writeObject(Object obj) throws IOException
第8题:
1.public class GC{2.private Objec to;3.private void doSomethingElse(Object obj){o=obj;}4.public void doSomething(){5.Object o=new Object();6.doSomethingElse(o);7.o=new Object();8.doSomethingElse(null);9.o=null;10.}11.}When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()
A.Line5
B.Line6
C.Line7
D.Line8
E.Line9
F.Line10
第9题:
在j2ee中,以下是firevetoablechange方法的正确的原型的是()
第10题:
1.public class GC{ 2.private Objec to; 3.private void doSomethingElse(Object obj){o=obj;} 4.public void doSomething(){ 5.Object o=new Object(); 6.doSomethingElse(o); 7.o=new Object(); 8.doSomethingElse(null); 9.o=null; 10.} 11.} When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()