Multiple Choice Question

Quiz Guidelines

 

QID: 
234
Tags: 
Question: 

Consider the following code to count objects and save the most recent object ...

int i = 0 ;
Object prevObject ;
public void saveObject(List e ){
prevObject = e ;
i++ ;
}

Which of the following calls will work without throwing an exception?

Select 3 options

A. saveObject( new ArrayList() );
B. Collection c = new ArrayList(); saveObject( c );
C. List l = new ArrayList(); saveObject(l);
D. saveObject(null);
E. saveObject(0); //The argument is the number zero and not the letter o

Q&A Set: