Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Compilation problem

Thread view: 
Petterson Mikael - 08 Jun 2006 08:57 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.