Importing other files

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Blong24

Importing other files

Post 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
Henrik S. Larsen

Re: Importing other files

Post by Henrik S. Larsen »

import DoodleCanvas.*;
or
import DoodleCanvas.anyPublicMethodInThisClass;
Henrik S. Larsen

Re: Importing other files

Post 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)
Post Reply