• Post Reply Bookmark Topic Watch Topic
  • New Topic

compiler telling me to make a file for a public class  RSS feed

 
derek smythe
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
derek smythe
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 55768
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
derek smythe wrote:. . . if a man can give birth I just did.
Series II episode 6 ("Parallel Universe")
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!