Can I call(access) non static method from static method ??
Like I have static method If yes, how??
public static void method() //like this is a static method
{
methodsec(); //from here I want to access non static method defined below
}
public void methodsec() // non static method
{
}
Yes, but you need a reference to do it through:
You need to think about which instance you want to call the method on. Instance methods typically use the state of the instance, so the method is likely to do different things depending on which instance it’s called on.