Sign in to follow this  

[java] Default argument values and array sizes.

This topic is 4866 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
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

This topic is 4866 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this