Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Source file and public class

 
Jiaqi Lin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, while doing the Java Rule Round-Up, I came across a question that says each source file need not have a public class. Can someone provide some examples, cos I am not really sure of what the question is asking.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can specify a "public" access modifier for a top-level class, which makes it accessible everywhere. If you don't specify an access modifier for a top-level class, then it has default access (restricted to the package). So the following could be a source file that does not contain a public class...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic