aspose 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


Win a copy of Spring in Action this week in the Spring forum!
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: 39393
    
  28
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: 39393
    
  28
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