Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Q&A

  1. Why do some of the byte stream methods in this hour use integers as arguments? Shouldn't they be using byte arguments?

    There's a different between the bytes in a stream and the bytes represented by the byte class. A byte in Java has a value ranging from –128 to 127, while a byte in a stream has a value from 0 to 255. You often have to use int when working with bytes for this reason—it can hold the values 128 to 255, while byte cannot.

Share ThisShare This

Informit Network