From: Patricia Shanahan on
Robbo wrote:
> And the second thing...
>
> Here http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.12
> you may find information that:
> "The following 37 tokens are the operators, formed from ASCII characters:
> Operator: one of
> = > < ! ~ ? :
> == <= >= != && || ++ --
> + - * / & | ^ % <<
>>> >>>
> += -= *= /= &= |= ^= %= <<=
>>> = >>>="

This table is correct by definition. Java is what the JLS says it is.

"new" is a keyword, not an operator. It is in the same category as "class".

> There is no information about "new" which is also operator:
> http://java.sun.com/docs/books/tutorial/java/javaOO/objectcreation.html
> "The new keyword is a Java operator that creates the object."

Tutorials are secondary documentation, not necessarily correct. If the
JLS and a tutorial disagree about an issue of Java language definition,
believe the JLS and ignore what the tutorial says.

> In tables of operators
> http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
> there is no information about "new".
>
> So, as you can see, I need GOOD table of operators, not any table of
> operators.

I would avoid the whole attempt to construct tables that cover
everything. Use tables for the things that can be summarized easily in
tables, but don't try to push everything into that model.

Note that some symbols have multiple roles in the syntax.

For example, a "(" it can be the start of a Parenthesized Expression,
part of the syntax for a Method Invocation Expression, or part of the
syntax, along with "new", for a Class Instance Creation Expression. "."
also has several uses.

Patricia
From: Roedy Green on
On Mon, 25 Jan 2010 01:21:11 +0100, "Robbo" <nie.mam(a)yle.com> wrote,
quoted or indirectly quoted someone who said :

>I need to create complete table of Java operators
>with their priorities and associations

see http://mindprod.com/jgloss/precedence.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
Don�t be discouraged by a failure. It can be a positive experience. Failure is, in a sense, the highway to success, inasmuch as every discovery of what is false leads us to seek earnestly after what is true, and every fresh experience points out some form of error which we shall afterwards carefully avoid.
~ John Keats (born: 1795-10-31 died: 1821-02-23 at age: 25)
From: Roedy Green on
On Mon, 25 Jan 2010 13:22:09 +0100, "Robbo" <nie.mam(a)yle.com> wrote,
quoted or indirectly quoted someone who said :

>
>If not, why tables of operators you provided me with include () [] and . ?

You could describe Java with a grammar that considered them as
operators with a precedence. They do fit into the precedence scheme
even if they don't usually cause any sort of calculation. (cast) does
sometime do a sort of computation.

--
Roedy Green Canadian Mind Products
http://mindprod.com
Don�t be discouraged by a failure. It can be a positive experience. Failure is, in a sense, the highway to success, inasmuch as every discovery of what is false leads us to seek earnestly after what is true, and every fresh experience points out some form of error which we shall afterwards carefully avoid.
~ John Keats (born: 1795-10-31 died: 1821-02-23 at age: 25)
From: Robbo on
Thanks for the answer. Well, this
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
seems to be complete table of operators in Java. The only problem
I see is lack of "cast operator".
Right?

Robbo


From: Joshua Cranmer on
On 01/25/2010 10:46 AM, Robbo wrote:
> Thanks for the answer. Well, this
> http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
> seems to be complete table of operators in Java. The only problem
> I see is lack of "cast operator".

Java calls it a "cast expression"; if you carefully read the JLS, you'll
notice it is at the same level of precedence as an unary operator.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: ?k???O?T?h???C
Next: JVM and java application