Difference between statement and keyword in Java

My understanding so far in Java has been that operators such things:

+,-,*,/,%,<,<=,== etc.

And keywords / reserved words are things like:

boolean,char,int,do,float,double,new etc.

However, looking through the Java book and online tutorial, I see what newis called an operator? But how, I thought, were operators specifically tied to arithmetic types? which, as I see it, is only 28. Why is the keyword newalso referred to as an operator?

thanks

+4
source share
3 answers

Quote from an excellent tutorial from Oracle (my attention):

: - Java , .

, . ; , . : Java, -, instanceof + ( ).

, , Scala, "" . Scala . - ... .

+6

: , : a = 2; b = 2 c = a + b; c = 4;

ex: a z A Z ..

: - , .

0

new not an operator, this is a keyword, according to JLS.

The list of operators is listed in JLS # 3.12 and is newnot in this list.

Also at the end of JLS # 15.10.1 you can see the mention of the "new keyword".

0
source

Source: https://habr.com/ru/post/1611983/


All Articles