Thanks that was it. Appreciate the help, now hopefully with the
combination of these functions I can put something together.
How do you know which classes you need to do a particular function?
Say for instance manipulate an image? Will java tell you when you
compile that it needs a library? I'm very new to java as you can tell
Thanks
> How do you know which classes you need to do a particular function?
Experience and guesswork. If you go to
http://java.sun.com/j2se/1.5.0/docs/api/ you'll see 3 frames. The bottom
left one contains a list of all classes in the standard Java class library.
You can browse through that and hope that their names accurately reflect
what they do.
> Say for instance manipulate an image?
I'd look for classes that have the word "image" or "graphic" in them.
> Will java tell you when you
> compile that it needs a library?
There's a bit of a terminology problem here. I'll try to clarify the
problem with an analogy: In the "real-non-Java-world", a library is a place
with a bunch of books. When you're doing a research project, it's not that
you borrow the library. Rather, you borrow books from the library.
So in Java, instead of "borrowing books", you "import classes" (you can
also import interfaces). That's what the import statements at the top of
most java source files are for: they tell the compiler which classes you're
going to need for this program.
If you try to use a class without importing it, the compiler will
complain.[*]
- Oliver
[*] There are two exceptions to this rule:
(1) Some classes, like Object, String, Thread, Math, etc. are imported
automatically. You don't need to import these.
(2) You can avoid importing classes by giving their full names. Instead of
importing ArrayList, you can use the full name "java.util.ArrayList".
Barkster - 06 Jun 2006 19:50 GMT
Cool, thanks for that great explaination. That is helpful
> > How do you know which classes you need to do a particular function?
>
[quoted text clipped - 31 lines]
> (2) You can avoid importing classes by giving their full names. Instead of
> importing ArrayList, you can use the full name "java.util.ArrayList".