Manoj Kumar Jain wrote:Is it only the size that matters while passing/recieving the data ?
When you passing the short, while method is expecting the long type is fine because short is the type of int/long. so by implicite casting the program runs without any error.
but while you are passing the byte while method is expecting character is not correct because byte can't be cast in to a character.
So, this is not only the size that matters but also the type of data that you are passing. Instead of passing the short if you pass the character type to method and define the method like this
It will work fine because the char is of type Integer, so it can be cast to int type.
This just sounds incorrect to me. If a char is of type int ... and a byte can't be passed to a char, then you are saying that a byte isn't of type int. Aren't you?
Why does the following work then?
This whole typing story just sounds wrong. But maby i'm mistaking. I think it has everything to do with size.