Dear Student,
All static methods work alike and you are not right in sense that we call non static method in static method by providing it a reference to the belonging object.
e.g. look at following code:
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Main m1 = new Main();
m1.disp1();
NewClass.disp();
}
public void disp1(){
System.out.println("its a non static method");
}
}
public class NewClass {
public static void disp(){
System.out.println("its a static method");
NewClass n1 = new NewClass();
n1.disp1();
}
public void disp1(){
System.out.println("its a non static method");
}
}
Output:
run:
its a non static method
its a static method
its a non static method