This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Look at the code above which is a modification of your version. I am sure you want to add 10 to the value entered by user, print it out and then exit. So, first of all, if you call printAny() before temp+=val, then the temp value would never be updated since you are exiting out of the program. And also saying printAny("temp") would pass the String "temp" but not the int value in temp. So change it to printAny(temp) and at the same time, modify your printAny(String temp) to printAny(int temp) since you are passing an integer. The above code should run fine without any errors