|
-
May 6th, 2006, 02:23 PM
#1
Thread Starter
Frenzied Member
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?
-
May 6th, 2006, 04:30 PM
#2
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
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|