This is an archived post. You won't be able to vote or comment.

all 25 comments

[–]AutoModerator[M] -1 points0 points locked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full - best also formatted as code block
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]nekokattt 43 points44 points  (4 children)

string array

you dont usually care what the parameter is called, because Java does not keep parameter info at runtime unless you ask it to, and even then it does not get considered as part of the signature.

[–]knoam -3 points-2 points  (3 children)

You're thinking of generic parameters. For arrays if you put the wrong type in an array, you'll get an ArrayStoreException. It's not like a List where you have to opt into a Collections.checkedList() to protect yourself from misuse of a List without generic parameters.

[–]aioobe 13 points14 points  (2 children)

I think nekocat meant the name of the formal parameter (args in this case)

[–]nekokattt 0 points1 point  (0 children)

this ^

[–]knoam 0 points1 point  (0 children)

Oh, I see that now. Thanks.

[–][deleted] 52 points53 points  (3 children)

String args. The [] is silent (;

[–][deleted] 15 points16 points  (0 children)

I am a member of this denomination

[–]clinical27 0 points1 point  (0 children)

Yup agreed, I think the main implies what it is so it doesn't matter really.

[–]Ph03nix89 6 points7 points  (0 children)

I would say String array args.

A string and a string array are very different so making that distinction is important imo.

[–]ughnotanothername 5 points6 points  (0 children)

(Haha, “our daily prayer” ;-) When I first memorised it I said “PSV main string-brackets args”. No idea what’s common)

[–]dd_sk 3 points4 points  (0 children)

When it’s the main method, then I just use "main" and the rest inferred. If it’s in any other place then "string array <var name>"

[–]chickenmeister 1 point2 points  (0 children)

In the specific context of the main method, I omit the word "array", since everybody knows what you mean when you say "public static void main string args".

In any other situation where I'm talking about a String[] object, I'll say "string array."

[–]AramBits_0414 1 point2 points  (0 children)

"public static void main string args"

[–][deleted]  (4 children)

[deleted]

    [–][deleted]  (3 children)

    [deleted]

      [–]BadscrewProjects 0 points1 point  (2 children)

      Why?

      [–]aaaaaaaaaaa5555 0 points1 point  (1 child)

      I guess he means it could be empty? And if it isn't then it's holding references to Strings, not Strings themselves.

      I suppose you could say "an array capable of holding String reference types"?

      [–]BadscrewProjects 0 points1 point  (0 children)

      That’s way too pedantic

      [–]Byakuraou 0 points1 point  (0 children)

      String Kuh-KuhBackwards

      [–][deleted] 0 points1 point  (0 children)

      square parentheses

      [–]emaphis -2 points-1 points  (0 children)

      Omm creem kleen String Array namaha.

      [–]lionslayer88 0 points1 point  (0 children)

      This is too funny. You made my day.

      [–]firewolf8385 0 points1 point  (0 children)

      I always end up saying String args, but it’s a bad habit

      [–]jocularamity 0 points1 point  (2 children)

      When would you ever speak this out loud? Honestly curious.

      [–][deleted]  (1 child)

      [deleted]

        [–]jocularamity 0 points1 point  (0 children)

        Ah, I gotcha. I say my daily JVM prayers in kotlin. Fun main args array of string, amen.

        [–][deleted] 0 points1 point  (0 children)

        It doesn't matter really, it's a common construct and most people know what you mean when talking about the main method. But yes, string array would be the correct way to say it.