File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Sequence of Method call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sequence of Method call" Watch "Sequence of Method call" New topic
Author

Sequence of Method call

Nagesh Vu
Greenhorn

Joined: Mar 18, 2010
Posts: 7
Hi,

I am lost in understanding the following piece of code:


Let me explain the way I understand this:
1. btnOpen object is instantiated of datatype Button.
2. setOnClickListener method on the object btnOpen is invoked. To this method we need to pass an object (I guess no variable is mentioned, but lets assume 'x' is passed).
a. As this object does not exist yet, a constructor for the object is invoked:

Here, I guess the author has actually coded the constructor.
b. Within the constructor, a method is invoked (on which object???).

Can someone explain me the method call sequence?

Thanks and Regards,
Nagesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

AWT and Swing event listeners are triggered by user interaction - a mouse click, key press, etc.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Sequence of Method call
 
Similar Threads
error while connecting to webservices
How to retrieve string from EditText?
Date Dialog error message
interface and constructor
force closes