Results 1 to 2 of 2
  1. #1
    mrjohn007 is offline Member
    Join Date
    Jan 2009
    Posts
    1
    Rep Power
    0

    Default need help about java class and object

    hi,

    I'm new to java and heres my question: What does it mean by this:
    ...
    private Classx Objx;
    ...
    Objx = SomeClass.getStuffx().getStuffz();<--???what does this mean???
    ...

    I think I understand when it says "SomeClass.getStuffx();". It means that it's calling the method "getStuffx()" which is inside the class "SomeClass". But what does this mean "SomeClass.getStuffx().getStuffz();"????

    Thanks
    John

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    That's simply chaining method invocations. It basically says, "Take the object returned by getStuffx() and invoke that object's getStuffz() method."

    The purpose is to cut down on explicitly defining variables to hold the result of every method invocation.

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Replies: 1
    Last Post: 01-29-2009, 09:35 AM
  3. Getting name of object class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-05-2007, 05:22 PM
  4. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 03:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •