Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

methods



take as given two classes : X and Y; where the main method is at X.

if i type a simple method at class Y, i am allowed to use it at X if and only if i create an object of the type Y while at X. once i have an object of the type Y, i am allowed to issue a call to any particular method typed at Y given that i use the dot separator such that :

y-object . nameofmethod();

why is it that being at X, i can call a given method located at Y by means of an object of the class Y.

what is the nature of this object Y created at class X, which is then used by methods at Y as a gateway to enter an second class, X in this case?

what's up with that? why do we have to create an object of type Y so that we can access methods at class Y? how can we determine the attributes of the object Y and how are these relevant to the calls made through these attributes.

any ideas. ranssff@hotmail.com