hello frenz,
is there any way to access Non-Static variables/methods from a static methd.
thanks and good luck
Ajay
-
How to access Non-Static variables from a Static methd (3 messages)
- Posted by: AjayKumar Ch
- Posted on: June 13 2003 01:07 EDT
Threaded Messages (3)
- 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
-
How to access Non-Static variables from a Static methd[ Go to top ]
- Posted by: Chetans
- Posted on: June 13 2003 03:21 EDT
- in response to AjayKumar Ch
Ajaykumar:
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 ?
Regards
Chetan -
Re:How to access Non-Static variables from a Static methd[ Go to top ]
- Posted by: Badrish Agarwal
- Posted on: June 26 2003 08:15 EDT
- in response to AjayKumar Ch
This is not possible if you are not creating
the corresponding object in the static method. -
Re:How to access Non-Static variables from a Static methd[ Go to top ]
- Posted by: Mushtaq Ahmed
- Posted on: September 03 2003 08:48 EDT
- in response to Badrish Agarwal
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.