This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes C / C++ and the fly likes Static not allowed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Static not allowed" Watch "Static not allowed" New topic

Static not allowed

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 215

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?

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

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?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link:
subject: Static not allowed
Similar Threads
Question on static keyword
New to EJB - question about static
static and non-static synchronized methods
static members in inner classes
static variables in beans