• Post Reply Bookmark Topic Watch Topic
  • New Topic

Meaning of line from android game book  RSS feed

 
Aman Grover
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the code for the class GameObject.java:


Code for Rectangle.java:


Code snippet for Vector2.java:


And a code snippet for SpatialhashGrid.java:


In the line:


Since I never used convention like this, I can't seem to understand what does this line mean? How can 3 objects be used in the same line with the dot(.) operator? Doesn't this mean ObjectA.ObjectB.ObjectC.variable? I have heard about chaining methods but not chaining objects.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means the GameObject class referred to by variable 'obj' has an instance field called 'bounds' which is an object type; 'bounds' has an instance field called 'lowerLeft' which is an object type and 'lowerLeft' has an instance field called 'x' which is probably a primitive type.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!