Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import my class

Status
Not open for further replies.

OOzy

Programmer
Jul 24, 2000
135
SA
Hello

I have a compiled class (syz.class) how can I import it or use it

HB
 
Hi bjaili!

1. If your class has a main method you can just use it with 'java syz.class'.

2. If your class just contains 'normal' methods you can access its public methods by creating an instance of your class (in another java file) and than you can call the method you want, e.g.:

syz myClass = new syz();
myClass.myMethod();

explanation:
myClass = instance of syz.class
myMethod = any public method of syz.class

I hope this was helpful (and correct).

cya

frag patrick.metz@epost.de
 
if it is in the same directory doing what frag said is fine. things get complicated when you start using packages if you really want to know about using packages have a look at
Chris Packham
kriz@i4free.co.nz

A thousand mokeys at a thousand machines, it happened, it got called the internet.
 
Hi Guys

Thank you . It worked.

HB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top