• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic