• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

compiler telling me to make a file for a public class

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76856
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

derek smythe wrote:. . . if a man can give birth I just did.

Series II episode 6 ("Parallel Universe")
 
Dinner will be steamed monkey heads with a side of tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic