Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot be applied to (java.io.PrintWriter) error

 
Rob Long
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys I get the following errors when trying to compile this PayApp program and I was wondering how to solve it
printPay() in PaySlip cannot be applied to (java.io.PrintWriter)
slip.printPay(slipWrite)
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the error again.
Try to relate the information (keywords, identifiers etc.) given in the error to your program and find what might be wrong.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extra hint, what variables does the method that you are calling take? Take a look at your method signature....
 
Rob Long
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the advice so far. I have removed the slipwrite within the brackets and the program runs ok. I was wondering if this would effect my ability to write results to a txt file for example.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well writing to a file would involve different APIs, I'd recommend starting at the Sun tutorial.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic