• 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

Anonymous Inner Class

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

Please find below the question asked in the K & B book.

now here the answer is E. But there is a mistake . please have a look on the statement.

System.out.println(new Runnable() {public void run() { }});

just before the semicolon there is a bracket ), which should not be there as i believe.
Please let me know whether i am correct or not.

Thanks in advance
Anvi Dixit
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like the brackets all line up to me:
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anvi Dixit:
Hello Everyone,

Please find below the question asked in the K & B book.

now here the answer is E. But there is a mistake . please have a look on the statement.

System.out.println(new Runnable() {public void run() { }});

just before the semicolon there is a bracket ), which should not be there as i believe.
Please let me know whether i am correct or not.

Thanks in advance
Anvi Dixit



The ) is necessary to complete the SOP.

This code would be the equivalent of

 
Anvi Dixit
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Keith and Cory .

I got ..infact i missed out that the bracket is for the SOP.

Thanks again
Anvi
 
reply
    Bookmark Topic Watch Topic
  • New Topic