Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Grant Young   on Oct 10 In Java Category.

  
Question Answered By: Archie Parker   on Oct 10

Well, sorry, but it should be. That's why we have compilers. To allow
programmers to write readable, maintainable, code at the expense of a bit of
run-time (in)efficiency.

It really doesn't matter whether the compiler creates new temporary
StringBuffer objects to hold the individual parts of the equation - it will
discard them when they're no longer needed. I'm surprised to hear you say
that it will, however, as that is certainly not what Sun said would happen
(in the example I quoted).

There may be the odd occasion when the efficiency of hand-coding
StringBuffer concatenations is needed. But, in the main, there is no point
and it is a very bad habit to get into. Keep the program  readable (by
others as well as yourself).

If you want to program with maximum efficiency and minimum memory, you'd be
better off in Assembler. :-)

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Problem in Fetching Values Or get search suggestion and latest updates.


Tagged: