This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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