letter | bit string |
h | 11000 |
e | 11001 |
l | 0 |
o | 10 |
' ' (space) | 11010 |
w | 11011 |
r | 1110 |
d | 1111 |
letter | frequency |
h | 1 |
e | 1 |
l | 3 |
o | 2 |
' ' (space) | 1 |
w | 1 |
r | 1 |
d | 1 |
Object x = new String("hello world");the expression
char c = x.charAt(0);is not legal in Java, because an Object does not have a charAt method, and x is an object, not a string
int i = x.hashCode();the corresponding method from the String class is invoked