• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

keep getting parameter error

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic