Problem with variable in class file.

Im working on a project from school where I read in a text file with numbers and print the max and the min. In my main file, I read in the text file and set the different numbers to variables a, b, and c. My question is, when Im writing my class file MaxMin, is there anyway to access those variables to compare them? Or will I have to do it some other way. Thanks for your help.

[386 byte] By [Lidberga] at [2007-10-3 3:19:28]
# 1
?Post some code to illustrater the question, and explain better, please
ChuckBinga at 2007-7-14 21:11:26 > top of Java-index,Java Essentials,New To Java...
# 2

Ok. Sorry

Here is the main code

import java.io.*;

import java.util.StringTokenizer;

public class LabAssign1

{

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

{

final int TOKENS_PER_LINE = 3;

String fileName = "labassign1.txt";

File theFile = new File(fileName);

FileInputStream theStream = new FileInputStream(theFile);

InputStreamReader theReader = new InputStreamReader(theStream);

BufferedReader input = new BufferedReader(theReader);

int numLines = 0;

String line = input.readLine();

while (line != null)

{

StringTokenizer st = new StringTokenizer(line);

if (line.length() == 3)

{

int a = Integer.parseInt(st.nextToken());

int b = Integer.parseInt(st.nextToken());

int c = Integer.parseInt(st.nextToken());

}

else

line = input.readLine();

}

input.close();

}

}

Is there any way to call variables a,b,and c in a separate class file?

Lidberga at 2007-7-14 21:11:26 > top of Java-index,Java Essentials,New To Java...
# 3

This is one way, but you really should be instantiating objects rather than using static classes. It's not a good approach.

public class LabAssign1

{

static int a;

public static void main(String[] args)

{

// ...

a = 1;

Other.print();

}

}

class Other

{

static void print()

{

System.out.println(LabAssign1.a);

}

}

ChuckBinga at 2007-7-14 21:11:26 > top of Java-index,Java Essentials,New To Java...
# 4
Thanks. Thats what I needed. Yeah, thats the way our teacher wanted us to do it. Its not the way I would have but, what are yah gonna do?
Lidberga at 2007-7-14 21:11:26 > top of Java-index,Java Essentials,New To Java...