Hi,
In a java source file we have the following:
String value = Boolean.toString(succeed);
When we compile we get:
Cannot resolve symbol toString()
We use jdk1.3.1_03_b03 mixed mode ( Solaris)
When we compile the same code on ( Linux) but with
jdk1.3.1_11 I get no compilation error.
Is it allowed to have major changes in the api even
if the the 1.3.1 is not changed? Or is this a bug in
the compiler?
cheers,
//mikael
Alex Whitney - 08 Jun 2006 11:36 GMT
That's because Boolean does not have a static toString() method.
toString() is invoked on an object, not called the way you were doing
it. At least according to the 1.3 API.
I've never used 1.3, but in 1.4+ you can do what you want like this:
String value = succeed + "";
I'm guessing you want the String "conversion" of a boolean for output.
If so, you can always do something like this:
System.out.println ("The value of succeed is " + succeed);
And if that doesn't work (if it wasn't implemented back then), you can
do:
String value = String.valueOf (succeed);
> Hi,
>
[quoted text clipped - 19 lines]
>
> //mikael
Chris Uppal - 08 Jun 2006 13:05 GMT
> In a java source file we have the following:
>
[quoted text clipped - 5 lines]
>
> We use jdk1.3.1_03_b03 mixed mode ( Solaris)
That's correct -- Boolean.toString(boolean) didn't appear until JDK 1.4.
> When we compile the same code on ( Linux) but with
>
> jdk1.3.1_11 I get no compilation error.
I'll bet you aren't really compiling with a 1.3 compiler.
Try doing
type javac
to find which compiler executable you are running, and
javac -version
to see what version it thinks it is (NB: that's java/C/ -version).
-- chris