Re: Boolean Input Question.
What package is the TextIO class in? Is there documentation for that package's classes?
What does the doc say?
Quote:
The console highlights this line as the problem
Are you saying your IDE is saying there is a problem with your code?
What error message do you get if you compile the program using the javac program?
Re: Boolean Input Question.
Hi,
The error message is:
Exception in thread "main" java.lang.IllegalArgumentException:
Illegal boolean input value.
Expecting one of: true, false, t, f, yes, no, y, n, 0, or 1
at TextIO.errorMessage(TextIO.java:950)
at TextIO.getBoolean(TextIO.java:826)
at TextIO.getlnBoolean(TextIO.java:619)
at Definitions.guess(Definitions.java:163)
at Definitions.main(Definitions.java:22)
Thanks David
Re: Boolean Input Question.
What does the method's doc say about when it will throw that exception?
Are you surprised that the exception was thrown? What did you enter that the method was trying to read and create a boolean value from?
Re: Boolean Input Question.
Hi,
As I said the program dosen't allow me to enter a thing it just stops there and the error message comes up. I'm sorry I don't know what the method's doc is.
Thanks David
Re: Boolean Input Question.
Quote:
I don't know what the method's doc is.
Its very important that you read the documentation for classes and their methods. Trying to code and use classes and their methods can be frustrating and a waste of time without reading the doc.
I have no idea what the TextIO class does so I can't say why it is doing what it is doing.
Try using the Scanner class instead. That is part of the Java SE classes and is well documented.
Re: Boolean Input Question.
Hi,
Thanks I will try the scanner class.
David