Java “Know it All”



I certainly don't know it all. This page was written to "honor" those who think they do, and perhaps to answer a few questions.

What is This?

Java Know it All is a set of experimental Java samples designed to confirm or deny various theories about the Java Virtual Machine that I have heard over the years. I post the source code with results here. You can also compile and run the code yourself in your own environment to see if your results are the same as mine.
Even in the realm of that which should be excatly known, there is a lot of unnecessary “opinion”. So I decided to find out for myself which of these various assertions was true.

Although source code files appear as ".java", they are actually ".txt" so that you can simply click on them and see them in your browser. Click the back arrow to return to this page.

Know It All Case #1: String Concatenation

Question. Do you need to use a StringBuffer during concatenation of a String in order to run more efficiently or will the JIT simply take care of that for you, thus allowing you to simply concatenate a String?
Read the source code StringKIA.java
Chris, I don't have time to run this code, just show me the results. Note, this was run within Eclipse.

Know It All Case #2: ArrayList vs Vector

Question. Does ArrayList's lack of a locking mechanism (and thus lack of thread safety) really make that much difference when it comes to speed? I have read that it doesn't.
Coming soon.

Know It All Case #3: String Reversal using no additional memory

This is simply an algorithm which can be written in just about any language. Read the source code ReverseAString.java
I won't bother to post the results. Needless to say it works.

Return to the Career Page
Return to the Code Samples and Projects Page