richATrichardjones
Technical User
Hi
I have four classes in my prog. The first one is called MainProg.java and it coordinates the other three. The next one is called ProxyServer.java. It will eventually be a proxy server but at the moment all it does is return an array of size 4 of integers. The next is called ClientGUI.java which makes the GUI appear on the screen. The next is histogram.java which takes teh array from ProxySever.java and make a histogram of it. Without ProxyServer it works fine. With proxyServer only returning a single number (instead of an array) it works fine. However when it return an array it says there is a thread exception so doesnt even get to the ClientGUI and Histogram code.
To be clearer the order of events (all within main in MainProg.java) is as follows:
MainProg.java
|
|
|---- ProxyServer.java
|
|---- ClientGUI.java
|
|-----Histogram.java
The code in MainProg that calls ProxyServer is as follows:
ProxyServer myProx = new ProxyServer();
temp = ProxyServer.getArray();
The error is on the first line.
The code for ProxyServer is:
class public ProxyServer{
private int[] myArray;
public ProxyServer()
{
myArray[0] = 100;
myArray[1] = 100;
myArray[2] = 100;
myArray[3] = 100;
};
public int[] ProxyServer.getArray()
{
return myArray;
}
}
The error seems really odd. Like I said earlier the code all works when ProxyServer returns a single value but I get a thread exception when it returns and array.
Thanks for any help
Richard
I have four classes in my prog. The first one is called MainProg.java and it coordinates the other three. The next one is called ProxyServer.java. It will eventually be a proxy server but at the moment all it does is return an array of size 4 of integers. The next is called ClientGUI.java which makes the GUI appear on the screen. The next is histogram.java which takes teh array from ProxySever.java and make a histogram of it. Without ProxyServer it works fine. With proxyServer only returning a single number (instead of an array) it works fine. However when it return an array it says there is a thread exception so doesnt even get to the ClientGUI and Histogram code.
To be clearer the order of events (all within main in MainProg.java) is as follows:
MainProg.java
|
|
|---- ProxyServer.java
|
|---- ClientGUI.java
|
|-----Histogram.java
The code in MainProg that calls ProxyServer is as follows:
ProxyServer myProx = new ProxyServer();
temp = ProxyServer.getArray();
The error is on the first line.
The code for ProxyServer is:
class public ProxyServer{
private int[] myArray;
public ProxyServer()
{
myArray[0] = 100;
myArray[1] = 100;
myArray[2] = 100;
myArray[3] = 100;
};
public int[] ProxyServer.getArray()
{
return myArray;
}
}
The error seems really odd. Like I said earlier the code all works when ProxyServer returns a single value but I get a thread exception when it returns and array.
Thanks for any help
Richard