Jump to content

View more

Image of the Day

I've done more tweaks to my color palette selector. #gamedev #screenshotsaturday #madewithunity https://t.co/aJXrC4ruRg
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[JAVA] Upcasted Anonymous Classes: Can You Access Unique Fields/Methods?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Shaquil   Members   

818
Like
0Likes
Like

Posted 02 June 2013 - 09:13 AM

[Removed]


Edited by Shaquil, 07 August 2015 - 06:47 AM.


#2 rip-off   Moderators   

10889
Like
2Likes
Like

Posted 02 June 2013 - 10:36 AM

Short of reflection, no. Also, don't use reflection =].

 

Anonymous inner classes are usually used to override the behaviour of one or more methods, most commonly single method interfaces such as Runnable, Callable and event handlers.



#3 Shaquil   Members   

818
Like
0Likes
Like

Posted 02 June 2013 - 05:57 PM

Short of reflection, no. Also, don't use reflection =].

 

Anonymous inner classes are usually used to override the behaviour of one or more methods, most commonly single method interfaces such as Runnable, Callable and event handlers.

 

Thanks. I've never heard of reflection, so I'll have to look it up.



#4 dmatter   Members   

4646
Like
0Likes
Like

Posted 03 June 2013 - 02:53 AM

are anonymous inner classes mostly for overloading a few methods without creating an entirely new class to do so?

Yes exactly, with "a few methods" usually being 1 or 2.
Typically they will just be implementing an interface too so all the behaviour is actually coming out of the anonymous class.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.