This content has been marked as final. Show 4 replies
When you apply the concat function on a string, it does not change the original string, it returns a new string with the desired result. So you have to assing the returned value to your variable. So, try this:
As an alternative, also look into the StringBuffer data type. It has the append() function that you can use without assigning the result back to the original variable. Once you are done, you can use StringBuffer.toString() to get the final String.
impossibleCFs = impossibleCFs.concat("Worst Case");
String.concat has been around since Java 1.0. Did you really think you were the first one to discover a bug in it? Thats what your title suggests. ;)
String is immutable so you cannot change it only return another String with the results.
In your case you would be better off using String Builder or a plain expression.
Shouldn't the last string be "Best Compress"
jLabel23.setText("It isn't possible to achieve" + (roundedWorstCompressFactor < 0.75 ? " Worst Case" : "") + (roundedAvgCompressFactor < 0.75 ? " Average Case" : "") + (roundedBestCompressFactor < 0.75 ? " Best Compress" : "") + " CFs");