I am using netbeans and I put the file in the src folder for the project with the java files.
Type: Posts; User: Xrrak
I am using netbeans and I put the file in the src folder for the project with the java files.
Scanner scan = new Scanner(new File("loanData.txt")); //provide file name from outside
int counter = 0; //keep track of how many in the file
while(scan.hasNextLine())
{
...
That worked as well. Thinking on it though I guess it is simplest to have it look on the main drive, unless there is a way to tell the program that the text file is in the same place the program is...
I replaced the "/" with "C://Users/Xrrak" and that did the trick. Thanks again.
If needed, I have also included the code for all for classes and the text file in case anyone needs to run it.
package week5;
/**
*
* @author Chad McCoy
*/
Thanks for pointing me in the right direction everyone, I now have the program reading from a sequential file into an array. The only issue I am having is making the path anywhere except "/". I have...
Thanks, know of any easy to understand tutorials for these ideas? I have looked at the Oracle tutorial site over and over and it just is not making sense to me.
I am having trouble figuring out what I want to do, and the idea seems like it would be simple. I have four lines in a text file, they are strings and include "7 years at 5.35%", "10 years at 5%",...