Java features explained with examples