Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic