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.
(I gave your code sample a little formatting so it would be easier to understand) Q1) Inner class declarations and class initialization blocks. Q2) You could just copy this program into a couple of .java files, compile and run... In my head, I think the answer will be 5.
Hi, I think i have two findings in your code. First, the variable c is an instance variable in TestIt and can not be accessed inside a static method like main. Second, even if we declare/define 'c ' inside main then we encounter the problem "Can't assign a value to a final variable: c" So, to me, the question looks like a wrong one. What do you think? Rgds, Saravanan