String Tokenizer

I am having trouble using the stringtokenizer to extract the numbers from my file and then find the max and average of them. I kept on getting errors so I have gone back to where it prints out the lines of my file and there are no errors.

Here is the code I have so far:

import java.io.*;

import java.util.StringTokenizer;

class Exam_1 {

public static void main (String[] args) throws IOException {

Exam_1 d = new Exam_1();

d.readMyFile();

}

//Read MyFile

void readMyFile() {

String reader = null;

int recCount = 0;

try { FileReader fr = new FileReader("Exam_1_File.java");

BufferedReader br = new BufferedReader(fr);

reader = new String();

while ((reader = br.readLine()) != null) {

recCount++; System.out.println(recCount + ": " + reader);

}

}

catch (IOException e) {

// catch possible io errors from readLine()

System.out.println("Uh oh, got an IOException error!");

e.printStackTrace();

}

} // end of readMyFile(

} // end of class

Here is my file it is reading from:

import java.text.*;

public class Exam_1_File{

public static void main(String[] args) {

double a = 16.54;

double b = 234.56;

double c = 143.65;

double d = 1.45;

double e = 97.43;

}

}

If anybody can help steer me in the right direction I would really appreciate it.

Thanks

[1491 byte] By [stymiesa] at [2007-11-26 21:06:53]
# 1
I see no usage of StringTokenizer anywhere in that application. So there's no helping you yet really. Surely you're not just asking someone to finish your homework for you are you?
warnerjaa at 2007-7-10 2:41:16 > top of Java-index,Java Essentials,Java Programming...
# 2
I do not want anyone to finish my homework for me, I have tried several diffent times to use StringTokenizer and I have not had any luck. I included the code I have so far because I know it runs with no errors. I cannot figure out to make the StringTokenizer work.
stymiesa at 2007-7-10 2:41:16 > top of Java-index,Java Essentials,Java Programming...
# 3

> I do not want anyone to finish my homework for me, I

> have tried several diffent times to use

> StringTokenizer and I have not had any luck. I

> included the code I have so far because I know it

> runs with no errors. I cannot figure out to make the

> StringTokenizer work.

I bet most of your trouble is due to the fact that you're reading a .java source code file, not a file containing an appropriate set of data from which to read.

warnerjaa at 2007-7-10 2:41:16 > top of Java-index,Java Essentials,Java Programming...
# 4
Ok, that was one of my questions.I was looking at some of my sample code and it was reading from a .java file and some were .txt files. I wasnt sure which to use. Thanks
stymiesa at 2007-7-10 2:41:16 > top of Java-index,Java Essentials,Java Programming...