• Post Reply Bookmark Topic Watch Topic
  • New Topic

Each class kept in its own file  RSS feed

 
Daniel o Keeffe
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i don't understand, the above code generates an error saying that class book is publc, should be declared in a file called book.java. It is. And when the the public modifier is left out of the class it comiles but I then get a load of compile errors java.lang.noclassdefound error.

TIA
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the actual error messages?
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel o Keeffe wrote:i don't understand, the above code generates an error saying that class book is publc, should be declared in a file called book.java.


Really? I would expect the error message to be suggesting a file named Book.java, not one named book.java. Yes, there's a difference. The Java language is case-sensitive, so "public class Book" and "public class book" aren't the same thing.

And welcome to the Ranch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!