well T1.test(); will absolutely never work. The test method is not static, and therefore you need an instance to access it.
I think the problem is related to classpath and using the -d switch with javac. But The original poster doesn't give us any error output, so I'm only speculating.
Scenario:
You compile the first file. Fine. Where does the generated class file go? If you're leaving it in the same directory as your source files for both classes, then this is a problem.
There are two posts that talk about compiling trouble that might be relevant here. One is from the
Java In General forum some time ago, and another is about
servlets, but they both refer to using the -d switch.
Problem with Packages / Utility Classes in Servlets (this one links to another
thread.. it's worth a read as well).
ARGH! Package problem while using * (the key to this one is in my second to last post, the 3rd last post in the thread. The paragraph that starts "In my case...". But don't just read from here; if you're still unsure after reading the whole thing, then focus on that paragraph.)