wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reg ; after a method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg ; after a method " Watch "Reg ; after a method " New topic
Author

Reg ; after a method

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Both the below codes compile fine
What is the use of ; in the below code ?
abstract class test
{

void method(){};
}

abstract class test
{

void method(){}
}
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
I am not very sure, but that could be an empty statement . Even if u put a ;anywhere in the code, it copiles. So putting a ; in front of a method signifies nothing but just an emply stmt...
Correct me if i am wrong.
Rashmi
Asma Zafar
Ranch Hand

Joined: May 11, 2001
Posts: 49
yeah ; just means an empty statement. Its not a CE.

------------------
Asma Zafar,
Sun Certified Programmer for Java2 Platform


Asma Zafar,<BR>Sun Certified Programmer for Java2 Platform
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Angela,
Semicolon ( after the curly brace (}) is not required.Even if you put it the compiler will not report an error.It is used to mark an end of a declaration or a statement.
-- Sandeep
SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
[This message has been edited by Desai Sandeep (edited September 01, 2001).]


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
HI,
If method() were an abstract method the ; would be necesary but without the curly braces.
abstract void method();

Terry


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reg ; after a method