In This video sir says that byte can not transfer into short, but byte can be easily transfer into short.pless help me.
About the data type part 1 video lecture
Hi @Shobhan,
Sir said that a short data type cannot be stored in a byte data type because short has a size of 2 bytes and byte data type has a size of 1 byte.
Take this in money terms … Let short be two rupee coin and byte be one rupee coin.So we cannot use 1 rupee coin to buy a item worth 2 rupee but we can buy a item worth 1 rupee using a 2 rupee coin. In the similar way we can store a small size data type in a big size data type but cannot store a big sized data type into a small size data type. Hope the money analogy is not misleading because the logic is simple. Or you can think of it as a container analogue. A 2L vessel may store 1L oil but a 1L vessel cannot store 2L oil as the oil will overflow.
You may be getting a misleading idea because byte is a data type and also a variable used to denote size. Short is made up of 2 bytes. Hope this will not confuse you as i tried to explain it nicely.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.