wood burning stoves*
The moose likes Cattle Drive and the fly likes Calling a method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Calling a method" Watch "Calling a method" New topic
Author

Calling a method

Gaia Nathan
Ranch Hand

Joined: Aug 01, 2001
Posts: 62
Hi. I came across this question and it has me puzzled. Can someone help me out? Here goes:
Suppose we have the following code to count events and save the most recent event.
int evtCt = 0;
AWTEvent lastE;
public void saveEvent(AWTEvent evt) {
lastE =evt;
evtCt++;
}
Which of the following calls of saveEvent would run without causing an exception. Select all which are correct.
a. call with an AWTEvent object reference.
b. call with an ActionEvent object reference.
c. call with an EventObject object reference.
d. call with null value.
End of question.
The answer given is a,b and d.
I can understand why a and b are chosen, but I don't understand why d is also chosen. Surely the method saveEvent() expects a parameter of some sort...
Thanks.

Thanks.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
This post seems to have nothing to do with the Cattle Drive assignments. I'm moving it to Java in General (beginning)


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a method
 
Similar Threads
Question, reference, package
Question from Exam Cram CD!
Exam Cram: page#112, Chapter #6, Question#3
from hardest questions
Calling a method