javastring

Can I specify what class to use for string concatenation when using a java compiler?


I have a java 1.5 compiler, and I'd prefer not to also have a 1.4 compiler, but I need to use it because, apart from string concatenation, everything built using the 1.5 compiler works in a 1.4 environment. The only difference is between StringBuilder and StringBuffer. Is there a way to make the 1.5 compiler use the 1.4 string concatenation class?


Solution

  • You can use the regular string concatenation (like "A" + "B") and while compiling the source, indicate the platform for which the .class files need to be generated using the javac's "-target" option.