• Post Reply Bookmark Topic Watch Topic
  • New Topic

one public class per file  RSS feed

 
N Sam
Ranch Hand
Posts: 77
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The compiler won't let me declare more than one class as "public". Am i correct in understanding that this is a java restriction ? This means i need to create a new file, for each public class that i want in a package ? The rest of the classes without access modifier will all be package-private. (Q has been asked before probably, but my search could not be narrowed).
 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N Sam wrote:Hi,

The compiler won't let me declare more than one class as "public".
Correct, unless the public class is an inner class.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!