Firstly, you can't access the non static methods directly from main. Instead create your Independence instance within the main method (check the variable assignment in your constructor its the wrong way round) and call its Iday method.
[ August 15, 2008: Message edited by: Richard Bradford ]
I have read sun tutorial,but actually I can't get the real picture fo it .
Please if I can get something about constructor. I know it is a foolish type question but please if I get some knoledge of it.
Be bold, Maheshwari!
Originally posted by Satya Maheshwari:
One way of looking constructor is to consider it as a suitable place where you can write code which needs to be executed whenever an object of that class is intantiated. The code should usually be doing the initialization stuff for that object.
The constructor is where you initialise the object. Not "should" or "usually." For the beginner, let's think of that as "always." [There are other ways to initialise objects, like factory methods, but let's look on them as more advanced than we need here.]
Every field has a default value when it is declared, but that is usually not suitable for real-life use, so you initialise them to "real" values in the constructor.
Nitin: who is teaching you programming? Have you got a course of any sort?