Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what does method().method() mean?  RSS feed

 
Vinay Thippeswamy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does method().method() mean. i mean what does

getServletConfig().getInitParameter("adminEmail")? mean?

iam not asking what exactly the above method does. but what does it mean.

i have come across objectname.method() or classname.method() in case of static methods.

but what does method().method() mean.
can anyone explain with a simple example please?

regards
vinay.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a basic Java syntax question so moving to Java In General (Beginner).
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vinay,

As you know, a method can return a value. That value can be an object on which you can call other methods. In your example, getServletConfig() returns a ServletConfig object. The ServletConfig object has a method getInitParameter(). Your line above is equivalent to:

ServletConfig sc = getServletConfig();
sc.getInitParameter("adminEmail");

You see, in the second line you could replace "sc" by "getServletConfig()", and you get your line of code.
 
Vinay Thippeswamy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks jesper. i got it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!