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.
You're creating two "ConvertInt" objects. Each one gets their own instance of the member variables "i" and "a", just as each person has their own pockets. When one object creates an Integer and stores it in "i", another ConvertInt is unaffected and its "i" remains null, just as putting a stone in your pocket doesn't automatically fill up your friend's pocket.
You need to call both those methods on the same ConvertInt object. Create it, store it in a variable in main(), then call the two methods via that variable.
Originally posted by anji_java: This is where U can realise the importance of the keyword "static".
Sorry to sound mean, but this is possibly the worst advice I've ever seen given out on JavaRanch. Making anything "static" here would be terrible, terrible style. The correct solution is to understand (as Phoebe now does) how objects work, and program accordingly.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com