This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes More than one!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "More than one!! " Watch "More than one!! " New topic
Author

More than one!!

Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129


Error Message:
AA111.java:1: class C is public, should be declared in a file named C.java
public interface C
^
AA111.java:6: class B is public, should be declared in a file named B.java
public interface B
^
2 errors

Why if I am using more than one 'public' class or interface raises an error?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

As the error messages imply, a public class X must be in a file named X.java. That's just the rule. You can include any number of nonpublic classes in a single file, however.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: More than one!!