Question:
After:
StringTokenizer st = new StringTokenizer(line);
Do I have to write:
String key = new String(st.nextToken());
or is it enough to write:
String key = st.nextToken();
Answer:
It is sufficient to write
String key = st.nextToken();
The nextToken() method will allocate a newString containing the next token and returnit. Creating a copy of that String isredundant and wastes memory and cycles.