wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on placement of ; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question on placement of ;" Watch "Question on placement of ;" New topic
Author

Question on placement of ;

Ashish Anant Patil
Greenhorn

Joined: Mar 17, 2013
Posts: 7
what does " ;" in middle of program or loop mean?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

It's an empty statement, and does nothing.

Can you give a specific code example?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ashish Anant Patil
Greenhorn

Joined: Mar 17, 2013
Posts: 7
for(int i=1;i<4;i++)
;
//more code...
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

That's a loop that lets i increment from 1 to 3, but does nothing in each iteration of the loop. Nobody would write something like that in real code, if they know what they are doing.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question on placement of ;