Some examples of threading in java