This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes short and byte Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "short and byte" Watch "short and byte" New topic

short and byte

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
What is the difference between a short and a byte datatype?What can be the range of numbers that i can include in short and byte?

Is it like short can be from -100 to 100?
Request help.

Shahnawaz Shakil
Ranch Hand

Joined: Aug 04, 2008
Posts: 57
Byte is 8 bit signed data type and short is 16 bit signed data type. Thus for byte, the range is -128 to 127. Please calculate the range of short yourself.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44048
See my first port of call for most of these thing, the Java Tutorials.
I agree. Here's the link:
subject: short and byte
It's not a secret anymore!