| Author |
compiler telling me to make a file for a public class
|
derek smythe
Ranch Hand
Joined: Apr 18, 2011
Posts: 63
|
|
Hi, any help greatly appreciated. The compiler is telling me that since two of my classes are "public", that I need to make separate files for them, which I know should not be the case right? So I pasted the code below so you can see it. and after that I posted the error. please. thank you gurus! Derek
On a side note! I would like to share a great trick with fellow newbie programmers, and when I say newbie, I mean first born. LOL. Ok, you select your compiler errors or type them, then google them in quotes, and search for the solution. If that doesn't work, try the forum, that's what I did.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
derek smythe wrote:The compiler is telling me that since two of my classes are "public", that I need to make separate files for them, which I know should not be the case right?
Nope. The compiler is right. A java file can only have one public top-level class, and that class has the same base name as the file.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
derek smythe
Ranch Hand
Joined: Apr 18, 2011
Posts: 63
|
|
|
Nevermind everything works now, I got it to run. Thanks so much for the help! This is like giving birth, LOL, if a man can give birth I just did.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32694
|
|
derek smythe wrote:. . . if a man can give birth I just did.
Series II episode 6 ("Parallel Universe")
|
 |
 |
|
|
subject: compiler telling me to make a file for a public class
|
|
|