File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classes" Watch "classes" New topic
Author

classes

lakshmi suji
Greenhorn

Joined: Jun 06, 2005
Posts: 2
in classes syntax at the last can we give a semicolon
if we give then will it show any error or not?
ex:
class Example
{
};
ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
why don't u compile it and see by the way i think u are talking about anonymus classes
Philip Heller
author
Ranch Hand

Joined: Oct 24, 2000
Posts: 119
The class definition ends at the closing curly bracket. The compiler thinks the semicolon marks the end of an empty statement. So you could even have:

which is a class definition followed by 10 empty statements.

The class is not necessarily inner.


Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Empty statements are almost always perfectly harmless.

I heard of a shop where programmers were rated by lines of code per month. The program that counted lines was not very smart, and people started decorating comment blocks like:


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classes