Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array

 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why cant i assign an int array to an Integer array?
 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
beacause the int cant be automatically boxed to Integer
whereas an Integer can be autoboxed to int automatically


well i may be wrong also just giving a try
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
write a code and you will find the answer. If you are unable to understand after that, then I will tell you.
hint: arrays are object
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OOK i guess i am unable to understand please give us the reason
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are waiting Neha
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raju Champaklal wrote:we are waiting Neha


Here is a bit more of a hint: Arrays are objects. Integer is an object. Can you cast an Array to an Integer?
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope because they arent in the same hierarchy..but so what? and what about float[] f=a? even this doesnt compile..why
 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i got it now
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
explain it to me Mahesh
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it because int[] and Integer[] arent in the same hierrachy?
 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well just open your k&b and start reading page no 233 you will understand it
Its really easy
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cant cast an array object that contains an int to an array object that contains float. think it is written in K&B you can add a short to an array of ints but can assign an array of short to an array of ints. I leave the reason for you to find it then I know you will understand it.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
time nahi he samjhne ka
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok then just remember that array of one primitive type cant be assigned to array of another primitive type
and you can put short byte char and int in an array of int.
and about the wrapper array i think you got that
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raju Champaklal wrote:time nahi he samjhne ka

If I remember, I told you before to not use Hindi on javaranch. People from all around the world visit javaranch, so please restrict yourself to using English...
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry again....wont happen again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic