class GFG {
public static void main (String[] args) {
GFG g=new GFG();
g.pri();
}
void pri(){
mod();
}
void mod()
{
System.out.println("HHI");
}
}
In this following code when i am calling a mod() method inside a non static method without creating class instance for mod() method it does work and given Output "Hi"; According to the definition of non static method cannot be called without Class instance;
How it does work?