- Posted by: AjayKumar Ch
- Posted on: June 13 2003 01:07 EDT
is there any way to access Non-Static variables/methods from a static methd.
thanks and good luck
- How to access Non-Static variables from a Static methd by Chetans on June 13 2003 03:21 EDT
- Re:How to access Non-Static variables from a Static methd by Badrish Agarwal on June 26 2003 08:15 EDT
- Re:How to access Non-Static variables from a Static methd by Mushtaq Ahmed on September 03 2003 08:48 EDT
Create a class instance in your static method and make a call. Remember
"public static void main" and later classinstance and calling object methods and members ?
This is not possible if you are not creating
the corresponding object in the static method.
Static methods/variables r created when class is loaded
Non Static variables r created when we make an instance of the class.
When class is loaded we dont have any instance of the class so we dont have any instance variables.
Therefore we cannot access instance variables form static methods.