• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic