global instance variable problem
Code:
import java.net.*;
import java.io.*;
public class GuessNumberHandlerServer {
}
class GuessNumberHandler extends Thread {
}
MagicNumber magNumb = new MagicNumber();
how can i declare that outside the functions?
so i can use mnumb.whatever (same instance of the magicnumber class) in both the 'public class' and the 'class' function?
what im actually trying to do is create magNumb in this: public class GuessNumberHandlerServer
and i want to use magNumb in the 'GuessNumberHandler extends Thread' please may someone tell me how?
Re: global instance variable problem
you seem to have a wrong idea about what a "Class" is, you should read more about Object Oriented Programming...After that, I'll be very glad to answer any questions