• Post Reply Bookmark Topic Watch Topic
  • New Topic

keep getting parameter error  RSS feed

 
Sally Curtis
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, i have the following method header

public static double askTall( BufferedReader keyb, String question )throws IOException

and in my program i have the following line using this method
double lengthRoom=askTall(keyb ,"How long is the room that you want to paint?");
i keep getting this error for all my lines that i use the method for

does anyone know why this is and how i can fix it?
[ edited to add code tags around compiler error, so as to help preserve formatting -ds ]
[ January 31, 2004: Message edited by: Dirk Schreckmann ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that the compiler is complaining that it doesn't know what the variable "keyb" is. I don't know what it is either. Is it declared and initialized somewhere?
From your method declaration, it looks as if "keyb" needs to be a BufferedReader of some kind. Do you have such a BufferedReader available to use?
If you don't have such a BufferedReader available, from the variable name, I'd guess that it's supposed to be a BufferedReader that gets input from the system console. You can create such a BuffereReader using the following line of code.
 
Maarten Vergouwen
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You dont show the rest of your program, but from the error I assume you havent declared keyb within the scope of the location where you make the call to your method.
Declare another BufferedReader (with another name, if only for clarity), and pass that to your method.

double lengthRoom=askTall(keyb ,"How long is the room that you want to paint?");
You try to pass 'keyb' to the procedure, but 'keyb' is not declared outside the scope of the method to which you want to pass it.

public static double askTall( BufferedReader keyb, String question )throws IOException
'keyb' is known within this method, but not outside it.

Hope it helps
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!