• Post Reply Bookmark Topic Watch Topic
  • New Topic

error ?  RSS feed

 
bairava surya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


when i remove the increment operator(get()[k]) program shows invalid statement may i know the reason behind it?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean when you write get()[k]; instead of get()[k]++;?

That happens because get()[k]; is an expression, but not a statement, and just an expression without doing anything with that expression (for example, assigning it to a variable) is not valid Java.

Why are you trying this, why do you think something like get()[k]; would make any sense? Or are you just trying random things for no good reason?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!