Wednesday, December 19, 2012

Initializing final things!


One thing I knew that final variables have to be initialized in very much the same line you declare them. So I embarked to see how things could go actually, rather than hearsay literature.So, following are a few code snippets that I tried, and obviously now, the first line of the paragraph is not absolutely correct.

Note: "final" variables are not always constants, as their values might not be available during compile time, and may be taken whilst the application is running.

Tuesday, December 4, 2012

How to pass arguments to "main" method in Eclipse or MyEclipse?

If you are running your main class (having main method) in console, for passing command line arguments, you could have done the following way:
java HelloWorld arg1 arg2
But many beginners find it difficult to pass as many arguments they wish if they are working on an IDE like Eclipse. So here are some simple steps to configure permanently for specific programs so that whenever they are run, automatically the programmer is asked for arguments.