Page 1 of 1

Importing other files

Posted: Thu Dec 05, 2002 6:46 am
by Blong24
Hi i have two files and one imports the other one.
DoodleCanvas.java
is used in Doodle.java

i have

import DoodleCanvas;

it gives me an error saying i need a "." after s

i have jsk1.4.1

please help....whats wrong? its an example right out of a book so please help soon

Re: Importing other files

Posted: Tue Dec 10, 2002 10:40 am
by Henrik S. Larsen
import DoodleCanvas.*;
or
import DoodleCanvas.anyPublicMethodInThisClass;

Re: Importing other files

Posted: Wed Dec 11, 2002 11:47 am
by Henrik S. Larsen
aaarrrhhh oops :-)
You cannot of course import methods. Sorry.

And more - if you do not have your classes in a package,
there is not need to import them. Just have them in the classpath.
If they are in the same package - again. No import needed.
If they are in a different package - you can either import the whole package
like my.package.* or just the class: my.package.Myclass

(too bad I cannot delete my first answer)