I am trying to create a class that calls another class. Some googling told me that I should be using packages, but I'm having a bit of trouble getting it to work.
So far, I have a class that defines a Die object. I wrote "package dice;" as the first line of code in that program. I am now trying to make a second program that uses Die objects. I wrote "package dice;" as the first line in that code, but when I try to compile the file it gives me "cannot find symbol" errors when I try to call new Die(). Any help with this would be appreciated. Thanks!!
If you go through the Java™ Tutorials, you can read all aboiut packages. At the bottom of the 3rd page, it says this:-
At your stage you are probably writing only small applications so you can “Generally speaking” use the unnamed package. Also, if you add package names, the compilation process becomes more difficult and you are liable to get all confused at a stage when you want everything as easy as possible.
If you do not use a package statement, your type ends up in an unnamed package. Generally speaking, an unnamed package is only for small or temporary applications or when you are just beginning the development process. Otherwise, classes and interfaces belong in named packages.