Java performs automatic type conversion when the type of the expression on the right hand side of an assignment operator safely promotes to the type of the variable on the left hand side of the assignment operator. Thus we can safely assign: byte -> short -> int -> long -> float -> double. Symbol (->) used here interprets to "to a".
Lets take an example,
// 64 bit long integer
long myLongInteger;
// 32 bit standard integer
int myInteger;
myLongInteger = myInteger;
In the above example, extra storage associated with the long integer, simply results in padding with extra zeros.
javaJAYESH SARVAIYA January 10, 2012 at 8:03 AM
give me always java questions
Type CastingChandra Sekar Jittim February 25, 2012 at 2:22 PM
What is Type Casting??
how would we use conversion javaravitheja June 8, 2012 at 11:14 AM
Java performs automatic type conversion when the type of the expression on the right hand side of an assignment operator safely promotes to the type of the variable on the left hand side of the assignment operator. Thus we can safely assign: byte -> short -> int -> long -> float -> double. Symbol (->) used here interprets to "to a". Lets take an example, // 64 bit long integer long myLongInteger; // 32 bit standard integer int myInteger; myLongInteger = myInteger; In the above example, extra storage associated with the long integer, simply results in padding with extra zeros.
Post your Comment