Legacy Java Syntax
Clash Royale CLAN TAG#URR8PPP
up vote
9
down vote
favorite
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
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.
add a comment |Â
up vote
9
down vote
favorite
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
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
add a comment |Â
up vote
9
down vote
favorite
up vote
9
down vote
favorite
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
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
java legacy
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.
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
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
edited 12 mins ago
answered 26 mins ago
Michael
16.2k62965
16.2k62965
add a comment |Â
add a comment |Â
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.
Harry King is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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