Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extra ; after Curly bracket close does't effect?

 
Rajiv Chopra
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even this won't have an effect.


;-) .. it's called an empty statement
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

int i = 0;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Thanks I was confused with Anonymous Inner class where ; is necessary otherwise compilation fail.
I hope that is the special case.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not the only special case. When using enums with a constructor and arguments passed you are forced to end the last item with a semicolon when you're not to without a constructor.
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:not the only special case. When using enums with a constructor and arguments passed you are forced to end the last item with a semicolon when you're not to without a constructor.


If I understand correct: Anum declaration within a class require(must use) ending };(semicolon) if we declare a constructor/method/variable inside enum declarion right??.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this



the semicolon after Item3 must be there, when however in the example before it can but doesn't have to be there.
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the semicolon after Item3 must be there, when however in the example before it can but doesn't have to be there.


Thankyou very much...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic