Java codes using various concepts of Java