Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static not allowed

 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
This may be bit elementary , but I want to know why static storage class not allowed as formal parameter , when it is perfectly ok to declare one inside that function?

Thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain exactly what you mean? Do you mean that you can't use 'static' for an argument variable:

void my_function(static int value) {
// ...
}

That is indeed not allowed, because it wouldn't make sense.

What would you expect it to mean to make an argument variable static? What should happen if you could do that?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic