Different programs in Java Language