







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Today:
Readings for Today: Assorted Materials on Java, Chapter 3.
Readings for Upcoming Topics: Data Structures (Into Java), Chap- ter 1; Head First Java, Chapter 16.
Reminder: You’re testing Project #1 now, right?
Type Bits Signed? Literals byte 8 Yes short 16 Yes
char 16 No
’a’ // (char) 97 ’\n’ // newline ((char) 10) ’\t’ // tab ((char) 8) ’\’ // backslash ’A’, ’\101’, ’\u0041’ // == (char) 65
int 32 Yes
0100 // Octal for 64 0x3f, 0xffffffff // Hexadecimal 63, -1 (!)
long 64 Yes
123L, 01000L, 0x3fL 1234567891011L
Type char Type byte
(^1 )
aByte + 3 == (int) aByte + 3 // Type int aLong + 3 == aLong + (long) 3 // Type long ’A’ + 2 == (int) ’A’ + 2 // Type int aByte = aByte + 1 // ILLEGAL (why?)
aByte += 1; // Defined as aByte = (byte) (aByte+1)
// Assume aChar is an upper-case letter char lowerCaseChar = (char) (’a’ + aChar - ’A’); // why cast?
Mask Set Flip Flip all 00101100 00101100 00101100 & 10100111 | 10100111 ^ 10100111 ~ 10100111 00100100 10101111 10001011 01011000
Left Arithmetic Right Logical Right 10101101 << 3 10101101 >> 3 10101100 >>> 3 01101000 11110101 00010101
x << n? x >> n? (x >>> 3) & ((1<<5)-1)?.
Mask Set Flip Flip all 00101100 00101100 00101100 & 10100111 | 10100111 ^ 10100111 ~ 10100111 00100100 10101111 10001011 01011000
Left Arithmetic Right Logical Right 10101101 << 3 10101101 >> 3 10101100 >>> 3 01101000 11110101 00010101
x << n? = x · 2 n. x >> n? (x >>> 3) & ((1<<5)-1)?.
Mask Set Flip Flip all 00101100 00101100 00101100 & 10100111 | 10100111 ^ 10100111 ~ 10100111 00100100 10101111 10001011 01011000
Left Arithmetic Right Logical Right 10101101 << 3 10101101 >> 3 10101100 >>> 3 01101000 11110101 00010101
x << n? = x · 2 n. x >> n? = bx/ 2 nc (i.e., rounded down). (x >>> 3) & ((1<<5)-1)?.
Mask Set Flip Flip all 00101100 00101100 00101100 & 10100111 | 10100111 ^ 10100111 ~ 10100111 00100100 10101111 10001011 01011000
Left Arithmetic Right Logical Right 10101101 << 3 10101101 >> 3 10101100 >>> 3 01101000 11110101 00010101
x << n? = x · 2 n. x >> n? = bx/ 2 nc (i.e., rounded down). (x >>> 3) & ((1<<5)-1)? 5-bit integer, bits 3–7 of x.