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

    Default need help about java class and object


    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();"????


  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Rep Power


    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, 03:12 AM
  2. Replies: 0
    Last Post: 04-06-2008, 07:43 PM
  3. Getting name of object class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-05-2007, 06: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