• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble calling this method  RSS feed

 
Mark Captain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble using this method

Main driver

How do i use the first method?

choice = out.printClosingMessage(???);
 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your method requires an object as parameter, you either need to create the object, or get it from some other method. Like:



Did that answer your question?

Ohh and please, use the code tag (above the edit window) to make code samples easier to read.
 
Mark Captain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fixed that problem but now I am getting a dead code? error

 
Nomaan Butt
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this statement is incorrect, you need to call handleLogin() method of LoginHandler class through its instance

 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Captain wrote: . . .

How do i use the first method? . . .
As far as I am concerned, you don’t. A class should be responsible for itself, so the printClosingMessage should be part of the account class. You would call it like this
account123.printClosingMessage();
or like this
account456.printClosingMessage(out);
depending whether you want to pass it a reference to an Output object or not.

Please avoid coloured text; many people find it difficult to read.
 
Mark Captain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for the help tonight, could not have done it with out you!
Everything is working fine =]
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome and well done sorting it out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!