File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Autoboxing question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Autoboxing question" Watch "Autoboxing question" New topic

Autoboxing question

Veer Batra
Ranch Hand

Joined: Mar 12, 2001
Posts: 35
Following code gives compile time error at line //a. Should it not use autoboxing to convert int(primitive) to Integer(wrapped).

Thanks in advance.
marc weber

Joined: Aug 31, 2004
Posts: 11343

Are you certain you're compiling with Java 1.5? It works fine for me.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306

javac -J-version

Use this to see your compiler version
Veer Batra
Ranch Hand

Joined: Mar 12, 2001
Posts: 35
Thanks for advising me to check version of java. Which actually seems the problem, However I am not able to establish which version I am using while in TextPad. But when I check at Dos prompt it gives me as under :

C:\Documents and Settings\Windows 2000>javac -version
javac 1.5.0_02

C:\Documents and Settings\Windows 2000>java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

Good news is that compilation and execution works at Dos prompt.

Any idea how to check java version while in Textpad.

FYI, I strongly believe that I have only one version of Java on my PC and that is 1.5.0_02.
Veer Batra
Ranch Hand

Joined: Mar 12, 2001
Posts: 35
Few other things which I tried:
1. uninstalled TextPad and Installed again but still same problem.
2. in TextPad/Tools/Run I tried to run "Javac -version" and I got "javac 1.5.0_02"
Veer Batra
Ranch Hand

Joined: Mar 12, 2001
Posts: 35
I installed Jbuilder yesterday which screwedup the setting. I uninstalled JDK as well as TextPad and installed again. JDK first and then TextPad and that fixed the problem. Thanks.

I agree. Here's the link:
subject: Autoboxing question
It's not a secret anymore!