• Post Reply Bookmark Topic Watch Topic
  • New Topic

"The public type <name> must be defined in its own file"  RSS feed

 
Chris Lotix
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

(Warning: Java beginner issue ahead )

I have a small issue understanding the following error message that Eclipse returns when i try to run the following code:



The message itself reads: "Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at FilmTester.main(Film.java:13)"

and the following on the line where the problem arises:

What gives? I'm positive i'm missing something obvious but i can figure it out why
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every public class/interface must be in a file named <classname>.java.
Check if your file is named with this pattern.

And I recommend you learn java using some text editor (like Notepad++) and compiling using javac, and running using java.
IDEs do much work for you. As this is really good for working, it's bad for learning.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!