L
Lawrence D'Oliveiro
Java copied C++ in using the word “new†to indicate class instantiation on
the heap. (Of course, Java is different in not having any other kind of
class instantiation.)
But what purpose does this word serve? Java defines no meaning for
“classname(args)†different from “new classname(args)â€. How many hundreds of
times a day do Java programms write something like
classname varname = new classname(args);
compared to, dare I say it, Python:
varname = classname(args)
I’m surprised Java never added a shorter form, say
classname varname(args);
which is of course straight out of C++.
the heap. (Of course, Java is different in not having any other kind of
class instantiation.)
But what purpose does this word serve? Java defines no meaning for
“classname(args)†different from “new classname(args)â€. How many hundreds of
times a day do Java programms write something like
classname varname = new classname(args);
compared to, dare I say it, Python:
varname = classname(args)
I’m surprised Java never added a shorter form, say
classname varname(args);
which is of course straight out of C++.