How to access Non-Static variables from a Static methd

Discussions

EJB design: How to access Non-Static variables from a Static methd

  1. hello frenz,

     is there any way to access Non-Static variables/methods from a static methd.

    thanks and good luck
    Ajay
  2. 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
  3. This is not possible if you are not creating
    the corresponding object in the static method.
  4. 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.