This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
mayank, your flood of unresearched questions is a red flag that this is homework. We don't smile upon that much around here.
You are better off researching your own questions. If you continue to post questions that are suspiciously homeworky, you may find your threads deleted and your JavaRanch account locked.
However, if you do research your own questions and post what you think along with the question, we're more than happy to accomodate. It will take more time on your part but the extra work will also cause you to learn the material. If you don't understand what I mean, please private message me and I can elaborate.
I've left your other recent threads here (though I did lock them), but only because some good people have taken their time to answer your questions and I'd hate to discount their contributions.