jQuery in Action, 2nd edition
The moose likes Bunkhouse Porch and the fly likes Downcasting  to Byte Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Books » Bunkhouse Porch
Reply locked New topic
Author

Downcasting to Byte

Sridhar Padala
Greenhorn

Joined: Aug 03, 2007
Posts: 20
class Magenta {
static byte a = (byte)127, b = (byte)128, c = (byte)255, d = (byte)256;
public static void main(String args[]) {
System.out.print(a + " " + b + " " + c + " " + d);
}}

How to type cast to byte if the value exceeds byte range? Please explain in detail

Thanks in Advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

Please take the time to choose the correct forum for your posts. This forum is for questions on books.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Downcasting to Byte
 
Similar Threads
Adding bytes and getting int
Wrapper Class
Mock Exam Question
Please teach me this problem!!
casting - from Dan's mock casting1