File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Type mismatch:cannot convert from int to Integer. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Type mismatch:cannot convert from int to Integer." Watch "Type mismatch:cannot convert from int to Integer." New topic
Author

Type mismatch:cannot convert from int to Integer.

Slaxmi Raj
Ranch Hand

Joined: Apr 20, 2012
Posts: 40

when i run this program , getting the error:type mismatch-can not convert int to Integer.
how i reduce this error, Anyone please tell me.

[Added code tags - see UseCodeTags for details]
Marcus Kelvin
Ranch Hand

Joined: Jan 04, 2012
Posts: 44
when i run this program , getting the error:type mismatch-can not convert int to Integer.


I don't get any errors for the code in the first post using oracle jdk 7 or icedtea jdk 6. What line is it on?

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

If you're using earlier than Java 1.5, then you'd expect line 14 to throw an error, because you're assigining an int to an Integer reference. Autoboxing allows that, but autoboxing was introduced in 1.5.

You do realise that if that line works it's a pointless statement, though?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type mismatch:cannot convert from int to Integer.
 
Similar Threads
what determines an object's methods
Overloading vs Overriding
Coding Standard - Time Cost Factor
overriding concept?
Triangular Output