Re: Writing apps for Windows platform in Java? Why?



Both are poor programming in their respective languages. Java also has
the StringBuilder class that is a lot better to use concatenation. The
code would be the folloing for the optimal usage:

Java:

StringBuilder sb = new StringBuilder("a");
for (int i = 0; i < 30000; i++) {
sb.append("a");
}
textArea.setText(sb.toString());

C#

StringBuilder sb = new StringBuilder("a");
for (int i = 0; i < 30000; i++) {
sb.Append("a");
}

textArea.Text = sb.ToString();

With the code above both run so fast that I can't measure with the
resources Ihave. However, notice that I put the toString()/ToString()
outside the loop.If I set the text of the textarea inside the loop with
StringBuilder, none of the codes end before I decide to stop it by
force.
.