aspose file tools*
The moose likes Java in General and the fly likes Java method calling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java method calling" Watch "Java method calling" New topic
Author

Java method calling

camey bensingh
Greenhorn

Joined: Apr 03, 2008
Posts: 3
What is the meaning of the following code,

Classname.MethodName1().MethodName2();

Pls any one explain.
Laxmikant Ruikar
Greenhorn

Joined: Nov 29, 2005
Posts: 23
Originally posted by camey camey:
What is the meaning of the following code,

Classname.MethodName1().MethodName2();

Pls any one explain.


Classname.MethodName1() represent one object of class, and you are invoking MethodName2() method on it.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hi "camey camey", Welcome to Javaranch,

seems like your name does not follow the Javaranch naming policy please change it here
Also please have a glance through the Ask Good Questions link below.
Thank you
[ April 18, 2008: Message edited by: Amit Ghorpade ]

SCJP, SCWCD.
|Asking Good Questions|
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39814
    
  28
Originally posted by Laxmikant Ruikar:
Classname.MethodName1() represent one object of class, and you are invoking MethodName2() method on it.
I think this needs a beginner's explanation; it is really a beginner's question.

  • If you start with Classname, then you are invoking its static method1
  • This method1 returns something which has a method called method2.
  • You are calling method2 on whatever that is.
  • Whoever coded that ought to have provided links in the Javadoc comments for whichever class it is to explain what its method1 returns.
  • Whoever coded that class should have given an explanation about what method2 does.
  • And Amit Ghorpade is right about displayed names.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: Java method calling