Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

autoboxing

 
vidu sri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why do i get exception in thread when i run the program
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Hint: "j=i; " line causes the exception here. When unboxing an Integer to int using intValue() method)

Do you see what those variables are referring to (specially i)?

EDIT : I had edited the wrong post earlier.



 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
REMOVED : Duplicate
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please supply more details; tell us what exception you are suffering (though Vijatha Kumar has guessed it ) and show us the stack trace, because that has useful line numbers on.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Please supply more details; tell us what exception you are suffering (though Vijatha Kumar has guessed it ) and show us the stack trace, because that has useful line numbers on.


Oh! It was too early to answer that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic