Campbell Ritchie wrote:You will need one .java file for each class marked public class at its beginning. The class Foo must be in a file called Foo.java.
If you put all your files in one directory, the different objects will have no difficulty finding each other to "talk to". Indeed, if there is any difficulty finding code, the compiler will complain and refuse to produce .class files, so you will know soon enough.
Dan Moody wrote:...the two files won't "talk to eachother" and none of them will compile and run...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber wrote:
Dan Moody wrote:...the two files won't "talk to eachother" and none of them will compile and run...
Your code compiles and runs for me. What are the exact error messages you're getting?
(Note that there is currently no output when this runs, but you can add that by calling playIt() on your Movie instances.)
Dan Moody wrote:
OK, and how would I call playIt() ?
Dan Moody wrote:I suppose the next question is, why can't I compile and run in cmd?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:
Dan Moody wrote:I suppose the next question is, why can't I compile and run in cmd?
That would depend on what error you get and what exactly you are typing on the command line (and what directory you are in when you do so...)
Assuming you are in the same directory as your .java files, you should be able to type
javac *.java
to compile them all. Try that, and tell us what you get.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors