File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Requirement of a class definition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Requirement of a class definition" Watch "Requirement of a class definition" New topic

Requirement of a class definition

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
I am studying for SCJP. I got a study pack. In there they say that there are three top level elements, which are namely Package decleration, importing classes and class definition. They further say that all these 3 is not needed but if they are there they should be in the above metioned order.
The question I am having is, what do they mean by class definition, if it is just 'class AnyName', how it is possible not to have this in a java program.
Please do advice me on this.
Thank you very much....

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Well, I guess the the class declaration isn't syntactically enforced (though I am not sure about it). A java file without it would be rather useless, though...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Thanks for the answer. But I got the answer, what there are meaning here is about the interfaces etc which doesn't have a class decleration.
I agree. Here's the link:
subject: Requirement of a class definition
jQuery in Action, 3rd edition