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 JAVA BEGGINER Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAVA BEGGINER" Watch "JAVA BEGGINER" New topic
Author

JAVA BEGGINER

Ar Yasoda
Greenhorn

Joined: Apr 04, 2007
Posts: 9
why semicolon in java is not compulsory where as in c++ it is required after the completion of any class.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'll move this to our beginners forum for you.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38350
    
  23
Welcome to the Ranch.

The position and presence and absence of semicolons in languages is not fixed by some law. It depends what the designers of the language thought and how they constructed the compiler. Different languages have semicolons in different places.

CR
Ar Yasoda
Greenhorn

Joined: Apr 04, 2007
Posts: 9
thanks for replying......
but how can jvm can know that the class has been ended..
Srikanth Ramu
Ranch Hand

Joined: Feb 20, 2007
Posts: 76
i guess it should be by } - curly brace
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38350
    
  23
Look in the Java Language Specification section 18.1; push ctrl-F then classBody. You will find:
ClassBody:
{ {ClassBodyDeclaration} }
So the compiler works out the end of the class body by counting { and }. Exactly as srikanth ramu said.
[ April 04, 2007: Message edited by: Campbell Ritchie ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA BEGGINER