File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Only One public class per file restriction ?
Joined: Dec 22, 2007
Jan 04, 2008 04:27:00
Hi folks ,
There is a rule in
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 ?
"You cannot change the truth but truth can change you "
Joined: Oct 13, 2005
Jan 04, 2008 04:37:00
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.
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Only One public class per file restriction ?
Classes in source file
HF Java 2ed
Class using Main without declaring itself Public
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015