[vbo 12/4/95]
The string returned from a substring() call cannot be successfully used as an argument
to the concat() call on another string. The following short program demonstrates the
problem.
---- Bug.java ----
class Bug {
public static void main(String argv[]) {
String s1 = new String("012345678901234567890..25...30...35");
String s2 = new String("Numbers will be concatenated here: ");
// it seems you can't concatenate a substring
s2.concat(s1.substring(0, 21));
System.out.println(s2);
// here's a workaround
s2 = s2 + s1.substring(0, 21);
System.out.println(s2);
}
}
---- output of above ----
(vbo) rootbeer other> javac Bug.java
0 errors
(vbo) rootbeer other> java Bug
Numbers will be concatenated here:
Numbers will be concatenated here: 012345678901234567890
The string returned from a substring() call cannot be successfully used as an argument
to the concat() call on another string. The following short program demonstrates the
problem.
---- Bug.java ----
class Bug {
public static void main(String argv[]) {
String s1 = new String("012345678901234567890..25...30...35");
String s2 = new String("Numbers will be concatenated here: ");
// it seems you can't concatenate a substring
s2.concat(s1.substring(0, 21));
System.out.println(s2);
// here's a workaround
s2 = s2 + s1.substring(0, 21);
System.out.println(s2);
}
}
---- output of above ----
(vbo) rootbeer other> javac Bug.java
0 errors
(vbo) rootbeer other> java Bug
Numbers will be concatenated here:
Numbers will be concatenated here: 012345678901234567890