This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Only One public class per file restriction ?

 
Shaan patil
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks ,


There is a rule in java which states that
Rule 1.Only one public class per file is allowed.

I tried compiling a file in which I had declared one class as public and other class as dedfault .I got compile error which stated above rule.

What may be the isuue ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely because you forgot the other half of that rule:

The file has to have the same name as the public class.

If you gave the file the same name as the default class, it won't compile.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic