• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is this type of method call? t.anim.getThis()

 
John Quach
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To me, it looks like a method within a method. What is this concept called?


Also, since Object is every class's superclass, is it possible to create an array of Objects that can take in many different types of objects?
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Quach wrote:Also, since Object is every class's superclass, is it possible to create an array of Objects that can take in many different types of objects?

This is a completely unrelated question, which really ought to have been posed in a distinct thread. However, the answer is yes. Anything that extends Object can be stored as an element in an Object[] array.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Quach wrote:To me, it looks like a method within a method. What is this concept called?

method call in a method is allowed. i think you may get something from here
John Quach wrote:
Also, since Object is every class's superclass, is it possible to create an array of Objects that can take in many different types of objects?

Arrays are co-variants . and array itself is a subclass of java.lang.Object
 
Randall Twede
Ranch Hand
Posts: 4439
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to me it looks like calling a public method of an inner class
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64964
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a simple method call. The rest is just chained references.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be poor style that you are using identifiers like t, and poor design if anim hasn’t got private access.
 
Randall Twede
Ranch Hand
Posts: 4439
3
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i recognize it now since i have written similar code on occasion. i will bet my last dollar that anim is at least package access. if you have ever created a "child" class passing it a reference to "this" in the constructor, then tried to access a private variable of the "parent" class, the compiler will tell you there are 2 options. make the variable package access or write a get method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic