Kindly find the fault in the code, as I'm not getting the requiredoutput - thanks

R

Roedy Green

The performance gains are just tales from the early days of JIT.

My reason for using final is clarity. When I see a final I know there
can't be lurking later a redefinition. Whenever is see a "missing"
final I know to look for one.

With hindsight, I think "final" should have been the default for
temporary variables and parameters. You should have had to use a "var"
keyword to permit redefinition later.

Hotspot does some incredible footwork finding un-overidden methods and
treating them as final, then changing its mind in mid flight (part way
through evaluating an expression!) if a new class is loaded that
overrides them. Final methods can be more directly addressed. I am
blown away that it works.

--
Roedy Green Canadian Mind Products
http://mindprod.com

"The industrial civilisation is based on the consumption of energy resources that are inherently limited in quantity, and that are about to become scarce. When they do, competition for what remains will trigger dramatic economic and geopolitical events; in the end, it may be impossible for even a single nation to sustain industrialism as we have know it in the twentieth century."
~ Richard Heinberg, The Party’s Over: Oil, War, and the Fate of Industrial Societies
 
R

Roedy Green

That is not really the true Java way.

Immutable objects (all fields final, values determined by the
constructor) are very much the "Java way". This circumvents all
manner of thread problems.

see http://mindprod.com/jgloss/immutable.html

We you just referring to final methods being a bad idea?
--
Roedy Green Canadian Mind Products
http://mindprod.com

"The industrial civilisation is based on the consumption of energy resources that are inherently limited in quantity, and that are about to become scarce. When they do, competition for what remains will trigger dramatic economic and geopolitical events; in the end, it may be impossible for even a single nation to sustain industrialism as we have know it in the twentieth century."
~ Richard Heinberg, The Party’s Over: Oil, War, and the Fate of Industrial Societies
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top