Jump to content
  • Advertisement
Sign in to follow this  
Lucidquiet

[java] Default argument values and array sizes.

This topic is 5076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a default value syntax for method parameters in java? I don't remember. And I'm not sure of this either, but I was wondering if there is syntax for specify the array size in a method declaration. Sorry, I know this is a boring topic, but I'm working on java code reader tool. I've checked out the JLS and BNF diagrams, a few places and since this is really a simple question you'd think it would be in one of those resources, but I can't find it in unambiguous language. Thanks for your help and time, L-

Share this post


Link to post
Share on other sites
Advertisement
Java does not support default parameter values, and the size of an array is not part of its type. (Keep in mind that when you pass it, all you pass is an array reference which might at different times point to different arrays of different sizes.)

Share this post


Link to post
Share on other sites
Right, what I was thinking was that java might have hidden functionality array sizes. I understand that an array is an Object, that is a contnguous block of memory with the final agreggate being the array's length.

I suppose the question stems more from C++. Where the first
dimension's size must be passed. But then again all array sizes more or less must be passed.

I just wanted to make sure this wasn't some obscure aspect of java that I was overlooking in my code reader.

Thanks.
L-

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!