• 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 is this type of method call? t.anim.getThis()

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to me it looks like calling a public method of an inner class
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's just a simple method call. The rest is just chained references.
 
Marshal
Posts: 79177
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4716
9
Scala Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic