This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I think this is going to a confused place. methodInB starting with a lower case "m" ought to be a method, not a class. From there we can only get more confused. So let's back up:
Now we can see that B is a class and someMethod is a method in B. When A wants to call someMethod in B it has to have a reference to an instance of B. So A does a "new B()" to create an instance and saves the reference in the variable "test". Then it can call the method.
Static methods are an exception to this rule, but let's wait a day to go there.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 16, 2003
Okay, so I forgot the "new"... I didn't mean to!
Joined: Jan 29, 2003
As I always said when teaching 5th grade band, any day we get to the end together is a good day!