0

can anyone help me this im just trying to read some integers into a linked list from a textfile the file will be something like this, ive done the code but it wont compile

Arrival Times      Burst times
23                      .5454
34                      .78
12                      .96

Code:

import java.util.LinkedList;
import java.util.ListIterator;
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileReader;


public class OSAssign
{


public static void main(String [] args) throws IOException
{
LinkedList processes = new LinkedList();
ListIterator itr = processes.listIterator();
FileReader fileReader = new FileReader(filename);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String inputString = bufferedReader.readLine();
while (inputString != null)
{
try
{
int entry = Integer.parseInt(inputString);
processes.add(new Integer(entry));
itr.next();
}
catch (NumberFormatException e)
{
System.err.println("Not an integer");
}
inputString = bufferedReader.readLine();
}
LinkedList.printList(processes);
}
}

Edited by happygeek: fixed formatting

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by freesoft_2000
0

Hi everyone,
What are errors that the compiler show. Post them here for us to see
and try not throw exceptions in the main as sometimes this causes the program to crash

Richard West

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.