Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What is the meaning of the term "zero-extends" and "sign extends" ?

843789May 6 2009 — edited May 6 2009
[JLS 1.0 |http://java.sun.com/docs/books/jls/first_edition/html/5.doc.html#170671] states that :

A widening conversion of a signed integer value to an integral type T simply sign-extends the two's-complement representation of the integer value to fill the wider format. A widening conversion of a character to an integral type T zero-extends the representation of the character value to fill the wider format.

What does this whole paragraph mean ? Do we have a example or some pointers to explain this ?

Thank you for your consideration.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2009
Added on May 6 2009
9 comments
862 views