Today I read another chapter from a free PDF downloadable book, whose chapters are all from other books for sale. Nice marketing tactic. This chapter was from a book called Java Puzzlers by Joshua Bloch. There were a number of words of wisdom contained inside.
For example, the + operator means string concatenation only when at least one of the operands is itself a String. Otherwise you get addition.
Here is another example stressed by my Java programming class instructor. The == operator tests whether two object references refer to the same object. It does not test whether the two objects contain an equivalent String. To do that requires the equals method.
We really did not get down to how the Java compiler works in my class or the book I read. However I found out that there are multiple passes. One of the first passes is translation of escape sequences. After that tokenization takes place.
Let me end with some tips that are not specific to the Java programming language. One is to not leave code commented out. Just delete it to prevent comprehension problems. The other is to avoid case statements within a switch statement to fall through to the next case. That is just bad practice.
Customer Sales Starts With Respect - I sold my old car recently. After turning in the license plates, I called my insurance company to cancel the insurance on the car. They said they could al...
3 days ago