• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what does method().method() mean?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a basic Java syntax question so moving to Java In General (Beginner).
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks jesper. i got it.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:. . . in the second line you could replace "sc" by "getServletConfig()", and you get your line of code.


thank you very much jasper
I register here just to say thank you
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MAO, welcome to the Ranch
 
reply
    Bookmark Topic Watch Topic
  • New Topic