Hi
I am helping a friend to prepare for Java exam (uni) and threre is this question that I don't know answer for...
FileInputStream fis;
DataInputStream dis;
int value1, value2;
fis = new FileInputStream("file.dat"
;
dis = newDataInputStream(fis);
value1 = dis.readUnsignedByte();
value2 = dis.readShort();
if 'file.dat' contains the byte values, F1 F2 F3 04 F5 06 F7 08 What is contained in value1 and value2 after execution?
I looked up what readUnsignedByte does ... it reads the next byte of this input stream, interpreted as an unsigned 8-bit number
but what is a next byte in this case ??? how many characters, 8 ??
same with readShort() it reads next two bytes of this input stream, interpreted as a signed 16-bit number what this will do ???
Thank you in advance for your help
I am helping a friend to prepare for Java exam (uni) and threre is this question that I don't know answer for...
FileInputStream fis;
DataInputStream dis;
int value1, value2;
fis = new FileInputStream("file.dat"
dis = newDataInputStream(fis);
value1 = dis.readUnsignedByte();
value2 = dis.readShort();
if 'file.dat' contains the byte values, F1 F2 F3 04 F5 06 F7 08 What is contained in value1 and value2 after execution?
I looked up what readUnsignedByte does ... it reads the next byte of this input stream, interpreted as an unsigned 8-bit number
but what is a next byte in this case ??? how many characters, 8 ??
same with readShort() it reads next two bytes of this input stream, interpreted as a signed 16-bit number what this will do ???
Thank you in advance for your help