runnable question

Does runnable need to be in the highest layer?let me ask in this way, I have class A which need runnableCan I involve 'class A' in 'Main class'?If yes, do I have to make 'Main class' runnable?Do I need to change anything in 'Main class'?thanks
[293 byte] By [marco_wua] at [2007-11-27 10:07:22]
# 1
?
BigDaddyLoveHandlesa at 2007-7-13 0:43:40 > top of Java-index,Java Essentials,Java Programming...
# 2

To "run" a class, it needs to be publically visible, and it needs to have a method with the appropriate signature.

It can therefore be in any package, and can be an inner class as long as it is static and public.

I wouldn't recommend calling a class with a main() entry point "runnable" because there's an interface called "Runnable" that is for other purposes. Your "highest layer" phrase could mean a variety of things, and "Main" isn't the name of any standard class. Learn the terminology otherwise it'll be hard to understand your questions.

Better yet, try it out, and post your code when you don't understand the outcome.

dcmintera at 2007-7-13 0:43:40 > top of Java-index,Java Essentials,Java Programming...