|Re: linking TextIO to Eclipse Java Project [message #1799133 is a reply to message #821835]
||Fri, 30 November 2018 10:22
| Enda McCabe
Registered: November 2018
For those of you foloowing a course that uses import textio.TextIO as you have discovered, this will not work in Eclipse.|
There is a simple way around this.
Instead of importing textio.TextIO you can import Scanner.
So all you do is at the start of your program replace:
with import java.util.Scanner;
in the "main" enter the following code
Scanner scan = new Scanner( System.in );
And where TextIO is used amend the code.
Here are a couple of examples. (usersGuess is an integer and playAgain a boolean)
usersGuess = TextIO.getInt();
becomes usersGuess = keyboard.nextInt();
playAgain = TextIO.getlnBoolean();
becomes playAgain = keyboard.nextBoolean();
I hope this helps.
[Updated on: Fri, 30 November 2018 15:37]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02776 seconds