Legacy Java Syntax

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
9
down vote

favorite
2












Reading the Java Code Conventions document from 1997, I saw this in an example on P16 about variable naming conventions:



int i;
char *cp;
float myWidth;


The second declaration is of interest - to me it looks a lot like how you might declare a pointer in C. It gives a syntax error when compiling under Java 8.



Just out of curiosity: was this ever valid syntax? If so, what did it mean?










share|improve this question







New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 4




    Yes, that's C - must have been a copy/paste error.
    – daniu
    36 mins ago






  • 5




    this was never a valid syntax
    – Sharon Ben Asher
    35 mins ago














up vote
9
down vote

favorite
2












Reading the Java Code Conventions document from 1997, I saw this in an example on P16 about variable naming conventions:



int i;
char *cp;
float myWidth;


The second declaration is of interest - to me it looks a lot like how you might declare a pointer in C. It gives a syntax error when compiling under Java 8.



Just out of curiosity: was this ever valid syntax? If so, what did it mean?










share|improve this question







New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 4




    Yes, that's C - must have been a copy/paste error.
    – daniu
    36 mins ago






  • 5




    this was never a valid syntax
    – Sharon Ben Asher
    35 mins ago












up vote
9
down vote

favorite
2









up vote
9
down vote

favorite
2






2





Reading the Java Code Conventions document from 1997, I saw this in an example on P16 about variable naming conventions:



int i;
char *cp;
float myWidth;


The second declaration is of interest - to me it looks a lot like how you might declare a pointer in C. It gives a syntax error when compiling under Java 8.



Just out of curiosity: was this ever valid syntax? If so, what did it mean?










share|improve this question







New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Reading the Java Code Conventions document from 1997, I saw this in an example on P16 about variable naming conventions:



int i;
char *cp;
float myWidth;


The second declaration is of interest - to me it looks a lot like how you might declare a pointer in C. It gives a syntax error when compiling under Java 8.



Just out of curiosity: was this ever valid syntax? If so, what did it mean?







java legacy






share|improve this question







New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 38 mins ago









Harry King

493




493




New contributor




Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Harry King is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 4




    Yes, that's C - must have been a copy/paste error.
    – daniu
    36 mins ago






  • 5




    this was never a valid syntax
    – Sharon Ben Asher
    35 mins ago












  • 4




    Yes, that's C - must have been a copy/paste error.
    – daniu
    36 mins ago






  • 5




    this was never a valid syntax
    – Sharon Ben Asher
    35 mins ago







4




4




Yes, that's C - must have been a copy/paste error.
– daniu
36 mins ago




Yes, that's C - must have been a copy/paste error.
– daniu
36 mins ago




5




5




this was never a valid syntax
– Sharon Ben Asher
35 mins ago




this was never a valid syntax
– Sharon Ben Asher
35 mins ago












1 Answer
1






active

oldest

votes

















up vote
6
down vote













It's a copy-paste error, I suppose.



From JLS 1 (which is really not that easy to find!), the section on Identifiers states




An identifier is an unlimited-length sequence of Java letters and Java
digits, the first of which must be a Java letter.

...

A Java letter is a character for which the method Character.isJavaLetter (§20.5.17) returns true




And the JavaDoc for that method states:




A character is considered to be a Java letter if and only if it is a
letter (§20.5.15) or is the dollar sign character '$' (u0024) or the
underscore ("low line") character '_' (u005F).




so foo, _foo and $foo were fine, but *foo was never valid.




If you want a more up-to-date Java style guide, Google's style guide is the arguably the most commonly referenced.






share|improve this answer






















    Your Answer





    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Harry King is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52697408%2flegacy-java-syntax%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote













    It's a copy-paste error, I suppose.



    From JLS 1 (which is really not that easy to find!), the section on Identifiers states




    An identifier is an unlimited-length sequence of Java letters and Java
    digits, the first of which must be a Java letter.

    ...

    A Java letter is a character for which the method Character.isJavaLetter (§20.5.17) returns true




    And the JavaDoc for that method states:




    A character is considered to be a Java letter if and only if it is a
    letter (§20.5.15) or is the dollar sign character '$' (u0024) or the
    underscore ("low line") character '_' (u005F).




    so foo, _foo and $foo were fine, but *foo was never valid.




    If you want a more up-to-date Java style guide, Google's style guide is the arguably the most commonly referenced.






    share|improve this answer


























      up vote
      6
      down vote













      It's a copy-paste error, I suppose.



      From JLS 1 (which is really not that easy to find!), the section on Identifiers states




      An identifier is an unlimited-length sequence of Java letters and Java
      digits, the first of which must be a Java letter.

      ...

      A Java letter is a character for which the method Character.isJavaLetter (§20.5.17) returns true




      And the JavaDoc for that method states:




      A character is considered to be a Java letter if and only if it is a
      letter (§20.5.15) or is the dollar sign character '$' (u0024) or the
      underscore ("low line") character '_' (u005F).




      so foo, _foo and $foo were fine, but *foo was never valid.




      If you want a more up-to-date Java style guide, Google's style guide is the arguably the most commonly referenced.






      share|improve this answer
























        up vote
        6
        down vote










        up vote
        6
        down vote









        It's a copy-paste error, I suppose.



        From JLS 1 (which is really not that easy to find!), the section on Identifiers states




        An identifier is an unlimited-length sequence of Java letters and Java
        digits, the first of which must be a Java letter.

        ...

        A Java letter is a character for which the method Character.isJavaLetter (§20.5.17) returns true




        And the JavaDoc for that method states:




        A character is considered to be a Java letter if and only if it is a
        letter (§20.5.15) or is the dollar sign character '$' (u0024) or the
        underscore ("low line") character '_' (u005F).




        so foo, _foo and $foo were fine, but *foo was never valid.




        If you want a more up-to-date Java style guide, Google's style guide is the arguably the most commonly referenced.






        share|improve this answer














        It's a copy-paste error, I suppose.



        From JLS 1 (which is really not that easy to find!), the section on Identifiers states




        An identifier is an unlimited-length sequence of Java letters and Java
        digits, the first of which must be a Java letter.

        ...

        A Java letter is a character for which the method Character.isJavaLetter (§20.5.17) returns true




        And the JavaDoc for that method states:




        A character is considered to be a Java letter if and only if it is a
        letter (§20.5.15) or is the dollar sign character '$' (u0024) or the
        underscore ("low line") character '_' (u005F).




        so foo, _foo and $foo were fine, but *foo was never valid.




        If you want a more up-to-date Java style guide, Google's style guide is the arguably the most commonly referenced.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 12 mins ago

























        answered 26 mins ago









        Michael

        16.2k62965




        16.2k62965




















            Harry King is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Harry King is a new contributor. Be nice, and check out our Code of Conduct.












            Harry King is a new contributor. Be nice, and check out our Code of Conduct.











            Harry King is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52697408%2flegacy-java-syntax%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            One-line joke