• 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

on the fly?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in the sentence below

Anonymous classes are typically used for creating objects on the fly in contexts such as in a return statements....... blah blah

what does the phrase ' on the fly ' mean?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Aafreen, The phrase "On the fly" indicates that you can create new extended classes without writing the whole syntax for class creation.


See below an example,
I have created an instance of the interface(Interface1) without creating any new class.
This is what it means, �Anonymous classes are created on the fly�

Hope this helps.



interface Interface1
{
public void callMe();
}

class Example
{
public static void main ( String args [ ] )
{
new Interface1()
{
public void callMe()
{
System.out.println("Anonymous");
}
}.callMe();
}
}
 
Aafreen Moinuddin
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amy.... iam glad
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic