Win a copy of Rust Web Development this week in the Other Languages 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

coupling

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Source: John Meyer's questions


a.Replace line 1 with main = c.getMain();
b.Replace line 1 with a call to coupler´┐Żs setMain method with the argument - main.
c.Replace line 2 with return pain; and make no other changes to the program.
d.No changes are required.
e.None of the above.


The answer given b. I feel both b and c are correct.

Thinking about it, may be not. Pain will not necessarily have the required main value all the time.
Anyway, what's the purpose of this code?
[ May 27, 2007: Message edited by: M Krishnan ]
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer b is incorrect, as it gives error "you cannot make static reference to the non static feild main".
I guess the answer is there is no problem with code (though it is not printing anything).
 
reply
    Bookmark Topic Watch Topic
  • New Topic