Why a non static method can't be called from a static method of same class?
for e.g
public class Abc(
public static void main(String[] args) {
testMe();
}
public void testMe()
{-------some lines of code----}
)
this code gives me an error.
Please explain.
Instructor
Ashish Thakur Replied on 29/10/2019
Please share the code that you are trying to execute.
Well, this is because a static method forms a static context where only static members can be accessed
Please use public static void testMe() {} to make it accessible when calling from a static method.
Testme() is non static function.. that is the reason you are not able to call it.
Instructor
Ashish Thakur Replied on 17/01/2020
We hope the issue has been resolved.
In case if it is not resolved yet. Please write back to us.